#[non_exhaustive]pub enum BidsError {
Show 21 variants
Io(Error),
Json(Error),
Validation(String),
RootNotFound(String),
MissingDatasetDescription,
MissingMandatoryField {
field: String,
},
DerivativesValidation(String),
Entity(String),
InvalidTarget(String),
NoMatch(String),
InvalidFilter(String),
ConflictingValues(String),
Database(String),
Csv(String),
Config(String),
PathBuilding(String),
FileType(String),
Http(String),
DataFormat(String),
Network(String),
Api(String),
}Expand description
Errors that can occur when working with BIDS datasets.
This enum covers all failure modes across the crate ecosystem, from
low-level I/O errors to high-level BIDS validation failures. It implements
From<std::io::Error> and From<serde_json::Error> for convenient
error propagation with ?.
§Example
use bids_core::BidsError;
let err = BidsError::validation("Missing required field");
assert!(err.is_validation());
assert!(!err.is_io());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Io(Error)
Json(Error)
Validation(String)
RootNotFound(String)
MissingDatasetDescription
MissingMandatoryField
DerivativesValidation(String)
Entity(String)
InvalidTarget(String)
NoMatch(String)
InvalidFilter(String)
ConflictingValues(String)
Database(String)
Csv(String)
Config(String)
PathBuilding(String)
FileType(String)
Http(String)
DataFormat(String)
Network(String)
Api(String)
Implementations§
Source§impl BidsError
impl BidsError
Sourcepub fn validation(msg: impl Into<String>) -> Self
pub fn validation(msg: impl Into<String>) -> Self
Create a validation error with a message.
Sourcepub fn data_format(msg: impl Into<String>) -> Self
pub fn data_format(msg: impl Into<String>) -> Self
Create a data format error with a message.
Sourcepub fn is_validation(&self) -> bool
pub fn is_validation(&self) -> bool
Returns true if this is a validation error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this is a “not found” type error.
Trait Implementations§
Source§impl Error for BidsError
impl Error for BidsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for BidsError
impl !RefUnwindSafe for BidsError
impl Send for BidsError
impl Sync for BidsError
impl Unpin for BidsError
impl UnsafeUnpin for BidsError
impl !UnwindSafe for BidsError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more