forked from jmug/stoatchat
Merge branch 'master' of github.com:revoltchat/backend into webhooks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use okapi::openapi3::{self, SchemaObject};
|
||||
use revolt_okapi::openapi3::SchemaObject;
|
||||
use revolt_rocket_okapi::revolt_okapi::openapi3;
|
||||
use rocket::{
|
||||
http::{ContentType, Status},
|
||||
response::{self, Responder},
|
||||
@@ -19,10 +20,10 @@ pub enum Error {
|
||||
/// This error was not labeled :(
|
||||
LabelMe,
|
||||
|
||||
// ? Onboarding related errors.
|
||||
// ? Onboarding related errors
|
||||
AlreadyOnboarded,
|
||||
|
||||
// ? User related errors.
|
||||
// ? User related errors
|
||||
UsernameTaken,
|
||||
InvalidUsername,
|
||||
UnknownUser,
|
||||
@@ -32,7 +33,7 @@ pub enum Error {
|
||||
BlockedByOther,
|
||||
NotFriends,
|
||||
|
||||
// ? Channel related errors.
|
||||
// ? Channel related errors
|
||||
UnknownChannel,
|
||||
UnknownAttachment,
|
||||
UnknownMessage,
|
||||
@@ -49,7 +50,7 @@ pub enum Error {
|
||||
AlreadyInGroup,
|
||||
NotInGroup,
|
||||
|
||||
// ? Server related errors.
|
||||
// ? Server related errors
|
||||
UnknownServer,
|
||||
InvalidRole,
|
||||
Banned,
|
||||
@@ -58,12 +59,12 @@ pub enum Error {
|
||||
},
|
||||
TooManyEmoji,
|
||||
|
||||
// ? Bot related errors.
|
||||
// ? Bot related errors
|
||||
ReachedMaximumBots,
|
||||
IsBot,
|
||||
BotIsPrivate,
|
||||
|
||||
// ? Permission errors.
|
||||
// ? Permission errors
|
||||
MissingPermission {
|
||||
permission: Permission,
|
||||
},
|
||||
@@ -74,7 +75,7 @@ pub enum Error {
|
||||
CannotGiveMissingPermissions,
|
||||
NotOwner,
|
||||
|
||||
// ? General errors.
|
||||
// ? General errors
|
||||
DatabaseError {
|
||||
operation: &'static str,
|
||||
with: &'static str,
|
||||
@@ -82,6 +83,7 @@ pub enum Error {
|
||||
InternalError,
|
||||
InvalidOperation,
|
||||
InvalidCredentials,
|
||||
InvalidProperty,
|
||||
InvalidSession,
|
||||
DuplicateNonce,
|
||||
VosoUnavailable,
|
||||
@@ -174,6 +176,7 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
Error::InternalError => Status::InternalServerError,
|
||||
Error::InvalidOperation => Status::BadRequest,
|
||||
Error::InvalidCredentials => Status::Unauthorized,
|
||||
Error::InvalidProperty => Status::BadRequest,
|
||||
Error::InvalidSession => Status::Unauthorized,
|
||||
Error::DuplicateNonce => Status::Conflict,
|
||||
Error::VosoUnavailable => Status::BadRequest,
|
||||
@@ -194,11 +197,11 @@ impl<'r> Responder<'r, 'static> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl rocket_okapi::response::OpenApiResponderInner for Error {
|
||||
impl revolt_rocket_okapi::response::OpenApiResponderInner for Error {
|
||||
fn responses(
|
||||
gen: &mut rocket_okapi::gen::OpenApiGenerator,
|
||||
) -> std::result::Result<openapi3::Responses, rocket_okapi::OpenApiError> {
|
||||
let mut content = okapi::Map::new();
|
||||
gen: &mut revolt_rocket_okapi::gen::OpenApiGenerator,
|
||||
) -> std::result::Result<openapi3::Responses, revolt_rocket_okapi::OpenApiError> {
|
||||
let mut content = revolt_okapi::Map::new();
|
||||
|
||||
let settings = schemars::gen::SchemaSettings::default().with(|s| {
|
||||
s.option_nullable = true;
|
||||
|
||||
Reference in New Issue
Block a user