[Canonical page](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/input-error-kind/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# InputErrorKind

The category of an [`InputError`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/input-error.md>): input that couldn't be decoded, or input that decoded but broke a validation rule. Read it from [`InputError::kind`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/input-error.md>) after matching [`Error::Input`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/error.md>).

## Declaration

```rust
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum InputErrorKind {
    Parse,
    Validation,
}
```

With the `serde` feature, `InputErrorKind` implements `Serialize` and `Deserialize` as `"parse"` and `"validation"`.

## Variants

| Variant | When it occurs |
|---|---|
| `Parse` | JSON input couldn't be decoded. Only the separate `plen-wire` decoding crate produces it; no call in `plen-core` returns it. The error's `path` is `None`. |
| `Validation` | The data or options passed to a call break a validation rule. Every [`Error::Input`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/error.md>) returned by a `plen-core` call has this kind, as does a converted [`MatchError::Invalid`](<https://docs.dhtmlx.com/planning-engine/rust/api/assign/match-error.md>). [`InputError::validation`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/input-error.md>) builds an error of this kind. |

## Example

```rust
use plen_core::{schedule, Error, InputErrorKind, ProjectData, SolveOptions, TaskData};

fn main() {
    // A task with no start, end or duration fails strict validation.
    let data = ProjectData {
        tasks: vec![TaskData::new(1)],
        ..Default::default()
    };

    match schedule(data, &SolveOptions::default()) {
        Err(Error::Input(e)) if e.kind == InputErrorKind::Validation => {
            println!("invalid input at {:?}: {}", e.path, e.message);
        }
        Err(e) => println!("other error: {e}"),
        Ok(result) => println!("{} updates", result.updates.len()),
    }
}
```

## Related

- [`InputError`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/input-error.md>) - carries the kind in `kind`
- [`Error`](<https://docs.dhtmlx.com/planning-engine/rust/api/core/errors/error.md>) - wraps the input error in `Error::Input`
- [Error handling](<https://docs.dhtmlx.com/planning-engine/rust/error-handling.md>) - shows how to report input errors
