bevy/crates/bevy_reflect/src/func/args/error.rs
Zachary Harrold 3cc1527e9e
Remove thiserror from bevy_reflect (#15766)
# Objective

- Contributes to #15460

## Solution

- Removed `thiserror` from `bevy_reflect`
2024-10-09 14:25:41 +00:00

34 lines
1015 B
Rust

use alloc::borrow::Cow;
use derive_more::derive::{Display, Error};
use crate::func::args::Ownership;
/// An error that occurs when converting an [argument].
///
/// [argument]: crate::func::args::Arg
#[derive(Debug, Error, Display, PartialEq)]
pub enum ArgError {
/// The argument is not the expected type.
#[display("expected `{expected}` but received `{received}` (@ argument index {index})")]
UnexpectedType {
index: usize,
expected: Cow<'static, str>,
received: Cow<'static, str>,
},
/// The argument has the wrong ownership.
#[display(
"expected {expected} value but received {received} value (@ argument index {index})"
)]
InvalidOwnership {
index: usize,
expected: Ownership,
received: Ownership,
},
/// Occurs when attempting to access an argument from an empty [`ArgList`].
///
/// [`ArgList`]: crate::func::args::ArgList
#[display("expected an argument but received none")]
EmptyArgList,
}