scopes_rs/error.rs
1//! Errors used by the crate
2
3use std::{error::Error, fmt::Display};
4
5/// The error returned by the derived implementation of [`FromStr`](std::str::FromStr)
6/// when no scope corresponds to the given string
7#[derive(Debug)]
8pub struct ScopeParseError(pub String);
9
10impl Display for ScopeParseError {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 write!(f, "no such scope: '{}'", self.0)
13 }
14}
15
16impl Error for ScopeParseError {}