Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit dfab2b5

Browse files
author
bitfl0wer
committed
feat: add tokenrevoked error
1 parent cf3917e commit dfab2b5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/errors.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ pub enum Errcode {
8282
/// One or many parts of the given input did not succeed validation against
8383
/// context-specific criteria
8484
IllegalInput,
85+
#[display("P2_CORE_TOKEN_REVOKED")]
86+
/// The access token the client used has been invalidated, and will not be
87+
/// valid for any further requests. The client should try to retrieve a new
88+
/// token.
89+
TokenRevoked,
8590
}
8691

8792
impl Errcode {
@@ -99,7 +104,8 @@ impl Errcode {
99104
"Creation of the resource is not possible, as it already exists".to_owned()
100105
}
101106
Errcode::IllegalInput => "The overall input is well-formed, but one or more of the input fields fail validation criteria".to_owned(),
102-
}
107+
Errcode::TokenRevoked => Errcode::TokenRevoked.to_string(),
108+
}
103109
}
104110
}
105111

@@ -110,6 +116,7 @@ impl ResponseError for Errcode {
110116
Errcode::Unauthorized => StatusCode::UNAUTHORIZED,
111117
Errcode::Duplicate => StatusCode::CONFLICT,
112118
Errcode::IllegalInput => StatusCode::BAD_REQUEST,
119+
Errcode::TokenRevoked => StatusCode::UNAUTHORIZED,
113120
}
114121
}
115122
}

0 commit comments

Comments
 (0)