Path: blob/main/crates/bevy_reflect/src/func/args/error.rs
6600 views
use alloc::borrow::Cow;12use thiserror::Error;34use crate::func::args::Ownership;56/// An error that occurs when converting an [argument].7///8/// [argument]: crate::func::args::Arg9#[derive(Debug, Error, PartialEq)]10pub enum ArgError {11/// The argument is not the expected type.12#[error("expected `{expected}` but received `{received}` (@ argument index {index})")]13UnexpectedType {14/// Argument index.15index: usize,16/// Expected argument type path.17expected: Cow<'static, str>,18/// Received argument type path.19received: Cow<'static, str>,20},21/// The argument has the wrong ownership.22#[error("expected {expected} value but received {received} value (@ argument index {index})")]23InvalidOwnership {24/// Argument index.25index: usize,26/// Expected ownership.27expected: Ownership,28/// Received ownership.29received: Ownership,30},31/// Occurs when attempting to access an argument from an empty [`ArgList`].32///33/// [`ArgList`]: crate::func::args::ArgList34#[error("expected an argument but received none")]35EmptyArgList,36}3738/// The given argument count is out of bounds.39#[derive(Debug, Error, PartialEq)]40#[error("argument count out of bounds: {0}")]41pub struct ArgCountOutOfBoundsError(pub usize);424344