diff options
| author | Matthieu <20992787+MatthieuCoder@users.noreply.github.com> | 2021-11-05 19:28:19 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-05 19:28:19 +0400 |
| commit | de73cf954c477a7f10f64b9caf3eea8f6550b8c8 (patch) | |
| tree | e61f4fd5bd6c515a5317adf8c8cbb10a362d91ff /webhook/src/handler/error.rs | |
| parent | b73f3c90ec2a491d59275818e3f61826471452ba (diff) | |
| parent | 7ddb5d3820c15ce4202e6f43057310a9fbb7178a (diff) | |
Merge pull request #14 from discordnova/feat/twilight
use twilight for deserialization and gateway
Diffstat (limited to 'webhook/src/handler/error.rs')
| -rw-r--r-- | webhook/src/handler/error.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/webhook/src/handler/error.rs b/webhook/src/handler/error.rs index f998b84..d4fee07 100644 --- a/webhook/src/handler/error.rs +++ b/webhook/src/handler/error.rs @@ -1,4 +1,4 @@ -use hyper::{Body, Response, StatusCode}; +use hyper::{header::ToStrError, Body, Response, StatusCode}; pub struct WebhookError { pub code: StatusCode, @@ -22,3 +22,15 @@ impl Into<Response<Body>> for WebhookError { .unwrap() } } + +impl From<hyper::Error> for WebhookError { + fn from(_: hyper::Error) -> Self { + WebhookError::new(StatusCode::BAD_REQUEST, "invalid request") + } +} + +impl From<ToStrError> for WebhookError { + fn from(_: ToStrError) -> Self { + WebhookError::new(StatusCode::BAD_REQUEST, "invalid request") + } +} |
