mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
character tokens
This commit is contained in:
1 parent
0d1a11e00e
commit
20cecd1742
2 files changed
+17
-3
No files matched your search
@@ -1,5 +1,7 @@
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use tokens::tokens::characters::CharacterToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ClientType {
|
||||
@@ -48,7 +50,13 @@ pub enum ClientError {
|
||||
MediaFileToUrlMapNotProvided,
|
||||
|
||||
/// A media file token was not found in the provided media-file-to-URL map.
|
||||
MediaFileTokenNotFoundInMap { token: String },
|
||||
MediaFileTokenNotFoundInMap { token: MediaFileToken },
|
||||
|
||||
/// The pre-dispatch context of character token to ID map was not supplied.
|
||||
CharacterTokenToKinoviCharacterIdNotProvided,
|
||||
|
||||
/// A character token was not found in the provided character-token-to-id map
|
||||
CharacterTokenNotFoundInMap { token: CharacterToken },
|
||||
}
|
||||
|
||||
impl Error for ClientError {}
|
||||
@@ -81,7 +89,13 @@ impl Display for ClientError {
|
||||
write!(f, "Media file to URL map was not provided")
|
||||
}
|
||||
Self::MediaFileTokenNotFoundInMap { token } => {
|
||||
write!(f, "Media file token '{}' was not found in the provided URL map", token)
|
||||
write!(f, "Media file token '{}' was not found in the provided URL map", token.as_str())
|
||||
}
|
||||
Self::CharacterTokenToKinoviCharacterIdNotProvided => {
|
||||
write!(f, "Character token to Kinovi character ID map was not provided")
|
||||
}
|
||||
Self::CharacterTokenNotFoundInMap { token } => {
|
||||
write!(f, "Character token '{}' was not found in the provided character-token-to-id map", token.as_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ fn resolve_token(
|
||||
let map = maybe_map.ok_or(ArtcraftRouterError::Client(ClientError::MediaFileToUrlMapNotProvided))?;
|
||||
map.get(token).cloned().ok_or_else(|| {
|
||||
ArtcraftRouterError::Client(ClientError::MediaFileTokenNotFoundInMap {
|
||||
token: token.as_str().to_string(),
|
||||
token: token.clone(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user