Skip to content

Commit

Permalink
chore(http): 50109 error, invalid JSON (#1338)
Browse files Browse the repository at this point in the history
  • Loading branch information
vilgotf authored Dec 18, 2021
1 parent c4a708d commit cd949b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions http/src/api_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ pub enum ErrorCode {
ServerNeedsMonetiazation,
/// This server needs more boosts to perform this action
ServerNeedsBoosts,
/// The request body contains invalid JSON.
RequestInvalidJson,
/// Two factor is required for this operation.
TwoFactorRequired,
/// No users with DiscordTag exist
Expand Down Expand Up @@ -434,6 +436,7 @@ impl ErrorCode {
Self::ServerNotAvailableLocation => 50095,
Self::ServerNeedsMonetiazation => 50097,
Self::ServerNeedsBoosts => 50101,
Self::RequestInvalidJson => 50109,
Self::TwoFactorRequired => 60003,
Self::NoSuchUser => 80004,
Self::ReactionBlocked => 90001,
Expand Down Expand Up @@ -587,6 +590,7 @@ impl From<u64> for ErrorCode {
50095 => Self::ServerNotAvailableLocation,
50097 => Self::ServerNeedsMonetiazation,
50101 => Self::ServerNeedsBoosts,
50109 => Self::RequestInvalidJson,
60003 => Self::TwoFactorRequired,
80004 => Self::NoSuchUser,
90001 => Self::ReactionBlocked,
Expand Down Expand Up @@ -740,6 +744,7 @@ impl Display for ErrorCode {
Self::ServerNotAvailableLocation => f.write_str("This server is not available in your location"),
Self::ServerNeedsMonetiazation => f.write_str("This server needs monetization enabled in order to perform this action"),
Self::ServerNeedsBoosts => f.write_str("This server needs more boosts to perform this action"),
Self::RequestInvalidJson => f.write_str("The request body contains invalid JSON"),
Self::TwoFactorRequired => f.write_str("Two factor is required for this operation"),
Self::NoSuchUser => f.write_str("No users with DiscordTag exist"),
Self::ReactionBlocked => f.write_str("Reaction was blocked"),
Expand Down Expand Up @@ -1129,5 +1134,10 @@ mod tests {
display: "Invalid Guild",
num: 50055,
});
assert_error_code(AssertErrorCode {
code: ErrorCode::RequestInvalidJson,
display: "The request body contains invalid JSON",
num: 50109,
})
}
}

0 comments on commit cd949b1

Please sign in to comment.