treewide: better cross-device sync capabilities; in-database storage
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id99798df6f7e4470caae8a193c2654aa6a6a6964
This commit is contained in:
parent
5521488a93
commit
f34c78b238
41 changed files with 8806 additions and 138 deletions
|
|
@ -69,3 +69,31 @@ impl From<pinakes_core::error::PinakesError> for ApiError {
|
|||
Self(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiError {
|
||||
pub fn bad_request(msg: impl Into<String>) -> Self {
|
||||
Self(pinakes_core::error::PinakesError::InvalidOperation(
|
||||
msg.into(),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn not_found(msg: impl Into<String>) -> Self {
|
||||
Self(pinakes_core::error::PinakesError::NotFound(msg.into()))
|
||||
}
|
||||
|
||||
pub fn internal(msg: impl Into<String>) -> Self {
|
||||
Self(pinakes_core::error::PinakesError::Database(msg.into()))
|
||||
}
|
||||
|
||||
pub fn forbidden(msg: impl Into<String>) -> Self {
|
||||
Self(pinakes_core::error::PinakesError::Authorization(msg.into()))
|
||||
}
|
||||
|
||||
pub fn unauthorized(msg: impl Into<String>) -> Self {
|
||||
Self(pinakes_core::error::PinakesError::Authentication(
|
||||
msg.into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub type ApiResult<T> = Result<T, ApiError>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue