Enum traq_bot_http::ParseError
source · pub enum ParseError {
ContentTypeNotFound,
ReadContentTypeFailed,
ContentTypeMismatch,
BotTokenNotFound,
ReadBotTokenFailed,
BotTokenMismatch,
BotEventNotFound,
ReadBotEventFailed,
BotEventMismatch,
ReadBodyFailed,
ParseBodyFailed,
}
Expand description
RequestParser::parse
時のエラー型
Variants
ContentTypeNotFound
- Content-Typeがヘッダーに含まれていないReadContentTypeFailed
- Content-Typeの値を読み取れなかったContentTypeMismatch
- Content-Typeの値がapplication/jsonで始まっていないBotTokenNotFound
- X-TRAQ-BOT-TOKENがヘッダーに含まれていないReadBotTokenFailed
- X-TRAQ-BOT-TOKENの値を読み取れなかった3BotTokenMismatch
- X-TRAQ-BOT-TOKENの値がverification_tokenと等しくないBotEventNotFound
- X-TRAQ-BOT-EVENTがヘッダーに含まれていないReadBotEventFailed
- X-TRAQ-BOT-EVENTの値を読み取れなかったBotEventMismatch
- X-TRAQ-BOT-EVENTの値がイベント名のいずれでもないReadBodyFailed
- リクエストボディの値を読み取れなかったParseBodyFailed
- リクエストボディの値をパースできなかった
Example
use traq_bot_http::RequestParser;
use traq_bot_http::ParseError;
use http::HeaderMap;
let verification_token = "verification_token";
let parser = RequestParser::new(verification_token);
let headers = HeaderMap::new();
let body = b"";
assert_eq!(parser.parse(headers, body), Err(ParseError::ContentTypeNotFound));
Variants§
ContentTypeNotFound
ReadContentTypeFailed
ContentTypeMismatch
BotTokenNotFound
ReadBotTokenFailed
BotTokenMismatch
BotEventNotFound
ReadBotEventFailed
BotEventMismatch
ReadBodyFailed
ParseBodyFailed
Trait Implementations§
source§impl Clone for ParseError
impl Clone for ParseError
source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ParseError
impl Debug for ParseError
source§impl Display for ParseError
impl Display for ParseError
source§impl Error for ParseError
impl Error for ParseError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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()
source§impl PartialEq<ParseError> for ParseError
impl PartialEq<ParseError> for ParseError
source§fn eq(&self, other: &ParseError) -> bool
fn eq(&self, other: &ParseError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ParseError
impl StructuralEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
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