diff --git a/Cargo.lock b/Cargo.lock index c27ed1a4025b3f234c0ded9fa018c50a41005cf8..b849d2e918c15c250bebc307087acc7554bd9e28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -646,12 +646,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "dotenv" version = "0.15.0" @@ -2338,8 +2332,8 @@ dependencies = [ [[package]] name = "rauth" -version = "0.2.5-alpha.0" -source = "git+https://gitlab.insrt.uk/insert/rauth?rev=c52758a5087cd035b0ed9c6eacc942ba5468d2ce#c52758a5087cd035b0ed9c6eacc942ba5468d2ce" +version = "0.2.6-alpha.0" +source = "git+https://gitlab.insrt.uk/insert/rauth?rev=d3f417a05cf7a26dd9d116c5abcdeacc975c53b9#d3f417a05cf7a26dd9d116c5abcdeacc975c53b9" dependencies = [ "chrono", "handlebars", @@ -2355,7 +2349,6 @@ dependencies = [ "rust-argon2", "serde", "serde_json", - "snafu", "tokio", "ulid", "validator", @@ -2516,7 +2509,6 @@ dependencies = [ "rocket_prometheus", "serde", "serde_json", - "snafu", "time 0.2.25", "ulid", "urlencoding", @@ -2924,27 +2916,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -[[package]] -name = "snafu" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" -dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", - "syn 1.0.60", -] - [[package]] name = "socket2" version = "0.3.19" diff --git a/Cargo.toml b/Cargo.toml index 8d8a3ba83f5b17203a0a37de74fd9e8c0e37094c..872959a4544ae4dbbe3e1887029933ba66533b2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ lazy_static = "1.4.0" urlencoding = "1.1.1" many-to-many = "0.1.2" lettre = "0.10.0-alpha.1" -snafu = { version = "0.6.9" } reqwest = { version = "0.10.8", features = ["json"] } serde = { version = "1.0.115", features = ["derive"] } validator = { version = "0.11", features = ["derive"] } @@ -42,7 +41,7 @@ async-std = { version = "1.8.0", features = ["tokio02", "attributes"] } async-tungstenite = { version = "0.10.0", features = ["async-std-runtime"] } rocket_cors = { git = "https://github.com/insertish/rocket_cors", branch = "master" } mongodb = { version = "1.1.1", features = ["tokio-runtime"], default-features = false } -rauth = { git = "https://gitlab.insrt.uk/insert/rauth", rev = "c52758a5087cd035b0ed9c6eacc942ba5468d2ce" } +rauth = { git = "https://gitlab.insrt.uk/insert/rauth", rev = "d3f417a05cf7a26dd9d116c5abcdeacc975c53b9" } rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", rev = "031948c1daaa146128d8a435be116476f2adde00" } rocket_prometheus = { git = "https://github.com/insertish/rocket_prometheus", rev = "3d825aedb42793246c306a81fe67c5b187948983" } rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "031948c1daaa146128d8a435be116476f2adde00", default-features = false } diff --git a/set_version.sh b/set_version.sh index d064dd05fa4b220b406710f3e45333fc5644aaa1..7e7ea8e7251c95d494e9f9245f46a7970d72f87f 100755 --- a/set_version.sh +++ b/set_version.sh @@ -1,3 +1,3 @@ #!/bin/bash -export version=0.4.1-alpha.11 +export version=0.4.1-alpha.12 echo "pub const VERSION: &str = \"${version}\";" > src/version.rs diff --git a/src/notifications/events.rs b/src/notifications/events.rs index 327130b426021778710daf66c5671ba6a0beaf5d..f6a90cd410812085c8a8160456483f719df48b10 100644 --- a/src/notifications/events.rs +++ b/src/notifications/events.rs @@ -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, } diff --git a/src/util/result.rs b/src/util/result.rs index b7edccefc6b99f4dd3bd3bd66adbcd88ebd15c27..e130c96c1e0bf1ac3d6bc631a28f6d9ccdcd8681 100644 --- a/src/util/result.rs +++ b/src/util/result.rs @@ -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, } diff --git a/src/version.rs b/src/version.rs index 013aa163913b820c979daf05d0abb1ac59c76c7f..be9c2743b5bf5ea33b27253f4cf9aad586fbc5d3 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "0.4.1-alpha.11"; +pub const VERSION: &str = "0.4.1-alpha.12";