forked from jmug/stoatchat
Remove snafu.
This commit is contained in:
@@ -2,23 +2,17 @@ use hive_pubsub::PubSub;
|
||||
use rauth::auth::Session;
|
||||
use rocket_contrib::json::JsonValue;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snafu::Snafu;
|
||||
|
||||
use super::hive::{get_hive, subscribe_if_exists};
|
||||
use crate::database::*;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Snafu)]
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(tag = "error")]
|
||||
pub enum WebSocketError {
|
||||
#[snafu(display("This error has not been labelled."))]
|
||||
LabelMe,
|
||||
#[snafu(display("Internal server error."))]
|
||||
InternalError { at: String },
|
||||
#[snafu(display("Invalid session."))]
|
||||
InvalidSession,
|
||||
#[snafu(display("User hasn't completed onboarding."))]
|
||||
OnboardingNotFinished,
|
||||
#[snafu(display("Already authenticated with server."))]
|
||||
AlreadyAuthenticated,
|
||||
}
|
||||
|
||||
|
||||
@@ -3,77 +3,49 @@ use rocket::http::{ContentType, Status};
|
||||
use rocket::request::Request;
|
||||
use rocket::response::{self, Responder, Response};
|
||||
use serde::Serialize;
|
||||
use snafu::Snafu;
|
||||
use std::io::Cursor;
|
||||
use validator::ValidationErrors;
|
||||
|
||||
#[derive(Serialize, Debug, Snafu)]
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Error {
|
||||
#[snafu(display("This error has not been labelled."))]
|
||||
LabelMe,
|
||||
|
||||
// ? Onboarding related errors.
|
||||
#[snafu(display("Already finished onboarding."))]
|
||||
AlreadyOnboarded,
|
||||
|
||||
// ? User related errors.
|
||||
#[snafu(display("Username has already been taken."))]
|
||||
UsernameTaken,
|
||||
#[snafu(display("This user does not exist!"))]
|
||||
UnknownUser,
|
||||
#[snafu(display("Already friends with this user."))]
|
||||
AlreadyFriends,
|
||||
#[snafu(display("Already sent a request to this user."))]
|
||||
AlreadySentRequest,
|
||||
#[snafu(display("You have blocked this user."))]
|
||||
Blocked,
|
||||
#[snafu(display("You have been blocked by this user."))]
|
||||
BlockedByOther,
|
||||
#[snafu(display("Not friends with target user."))]
|
||||
NotFriends,
|
||||
|
||||
// ? Channel related errors.
|
||||
#[snafu(display("This channel does not exist!"))]
|
||||
UnknownChannel,
|
||||
#[snafu(display("Attachment does not exist!"))]
|
||||
UnknownAttachment,
|
||||
#[snafu(display("Cannot edit someone else's message."))]
|
||||
CannotEditMessage,
|
||||
#[snafu(display("Cannot send empty message."))]
|
||||
EmptyMessage,
|
||||
#[snafu(display("Cannot remove yourself from a group, use delete channel instead."))]
|
||||
CannotRemoveYourself,
|
||||
#[snafu(display("Group size is too large."))]
|
||||
GroupTooLarge { max: usize },
|
||||
#[snafu(display("User already part of group."))]
|
||||
AlreadyInGroup,
|
||||
#[snafu(display("User is not part of the group."))]
|
||||
NotInGroup,
|
||||
|
||||
// ? General errors.
|
||||
#[snafu(display("Trying to fetch too much data."))]
|
||||
TooManyIds,
|
||||
#[snafu(display("Failed to validate fields."))]
|
||||
FailedValidation { error: ValidationErrors },
|
||||
#[snafu(display("Encountered a database error."))]
|
||||
DatabaseError {
|
||||
operation: &'static str,
|
||||
with: &'static str,
|
||||
},
|
||||
#[snafu(display("Internal server error."))]
|
||||
InternalError,
|
||||
#[snafu(display("Missing permission."))]
|
||||
MissingPermission,
|
||||
#[snafu(display("Operation cannot be performed on this object."))]
|
||||
InvalidOperation,
|
||||
#[snafu(display("Email or password is incorrect."))]
|
||||
InvalidCredentials,
|
||||
#[snafu(display("Already created an object with this nonce."))]
|
||||
DuplicateNonce,
|
||||
#[snafu(display("Voso is not enabled on this instance."))]
|
||||
VosoUnavailable,
|
||||
#[snafu(display("This request had no effect."))]
|
||||
NoEffect,
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
pub const VERSION: &str = "0.4.1-alpha.11";
|
||||
pub const VERSION: &str = "0.4.1-alpha.12";
|
||||
|
||||
Reference in New Issue
Block a user