misc-errors: Allow or make error enums non_exhaustive
This commit is contained in:
parent
fd310e5b6e
commit
c55dab7122
@ -4,6 +4,7 @@ use std::fmt;
|
|||||||
|
|
||||||
/// An error encountered when trying to parse an invalid ID string.
|
/// An error encountered when trying to parse an invalid ID string.
|
||||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// The client secret is empty.
|
/// The client secret is empty.
|
||||||
EmptyClientSecret,
|
EmptyClientSecret,
|
||||||
|
@ -24,6 +24,7 @@ pub fn to_string<T: Serialize>(val: &T) -> Result<String, Error> {
|
|||||||
|
|
||||||
/// The set of possible errors when serializing to canonical JSON.
|
/// The set of possible errors when serializing to canonical JSON.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::exhaustive_enums)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// The numeric value failed conversion to js_int::Int.
|
/// The numeric value failed conversion to js_int::Int.
|
||||||
IntConvert,
|
IntConvert,
|
||||||
|
@ -15,6 +15,7 @@ pub type Object = BTreeMap<String, CanonicalJsonValue>;
|
|||||||
|
|
||||||
/// Represents a canonical JSON value as per the Matrix specification.
|
/// Represents a canonical JSON value as per the Matrix specification.
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
|
#[allow(clippy::exhaustive_enums)]
|
||||||
pub enum CanonicalJsonValue {
|
pub enum CanonicalJsonValue {
|
||||||
/// Represents a JSON null value.
|
/// Represents a JSON null value.
|
||||||
///
|
///
|
||||||
|
@ -52,6 +52,7 @@ impl<'input, 'output, Target: UrlEncodedTarget> Serializer<'input, 'output, Targ
|
|||||||
|
|
||||||
/// Errors returned during serializing to `application/x-www-form-urlencoded`.
|
/// Errors returned during serializing to `application/x-www-form-urlencoded`.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// UTF-8 validation failed.
|
/// UTF-8 validation failed.
|
||||||
Utf8(str::Utf8Error),
|
Utf8(str::Utf8Error),
|
||||||
|
@ -109,6 +109,7 @@ impl JsonError {
|
|||||||
|
|
||||||
/// A JSON type enum for [`JsonError`] variants.
|
/// A JSON type enum for [`JsonError`] variants.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::exhaustive_enums)]
|
||||||
pub enum JsonType {
|
pub enum JsonType {
|
||||||
/// A JSON Object.
|
/// A JSON Object.
|
||||||
Object,
|
Object,
|
||||||
@ -253,6 +254,7 @@ impl ParseError {
|
|||||||
|
|
||||||
/// An error when trying to extract the algorithm and version from a key identifier.
|
/// An error when trying to extract the algorithm and version from a key identifier.
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum SplitError {
|
pub enum SplitError {
|
||||||
/// The signature's ID does not have exactly two components separated by a colon.
|
/// The signature's ID does not have exactly two components separated by a colon.
|
||||||
#[error("malformed signature ID: expected exactly 2 segment separated by a colon, found {0}")]
|
#[error("malformed signature ID: expected exactly 2 segment separated by a colon, found {0}")]
|
||||||
|
@ -50,6 +50,7 @@ impl Verifier for Ed25519Verifier {
|
|||||||
/// that the event has been redacted. In this case, receiving homeservers should store a redacted
|
/// that the event has been redacted. In this case, receiving homeservers should store a redacted
|
||||||
/// version of the event.
|
/// version of the event.
|
||||||
#[derive(Clone, Debug, Hash, PartialEq)]
|
#[derive(Clone, Debug, Hash, PartialEq)]
|
||||||
|
#[allow(clippy::exhaustive_enums)]
|
||||||
pub enum Verified {
|
pub enum Verified {
|
||||||
/// All signatures are valid and the content hashes match.
|
/// All signatures are valid and the content hashes match.
|
||||||
All,
|
All,
|
||||||
|
@ -6,6 +6,7 @@ pub type Result<T> = std::result::Result<T, Error>;
|
|||||||
|
|
||||||
/// Represents the various errors that arise when resolving state.
|
/// Represents the various errors that arise when resolving state.
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// A deserialization error.
|
/// A deserialization error.
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user