Add message sending.

This commit is contained in:
Paul Makles
2021-01-18 20:07:42 +00:00
parent c401663c47
commit c6ba72d924
3 changed files with 66 additions and 1 deletions

View File

@@ -31,6 +31,10 @@ pub enum Error {
#[snafu(display("You have been blocked by this user."))]
BlockedByOther,
// ? Channel related errors.
#[snafu(display("Already sent a message with this nonce."))]
AlreadySentMessage,
// ? General errors.
#[snafu(display("Failed to validate fields."))]
FailedValidation { error: ValidationErrors },
@@ -62,6 +66,8 @@ impl<'r> Responder<'r, 'static> for Error {
Error::Blocked => Status::Conflict,
Error::BlockedByOther => Status::Forbidden,
Error::AlreadySentMessage => Status::Conflict,
Error::FailedValidation { .. } => Status::UnprocessableEntity,
Error::DatabaseError { .. } => Status::InternalServerError,
Error::InternalError => Status::InternalServerError,