mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
rewrite all the error display strings
Now that we log the source chain, there is no need to format the source error in display. Also, a lot of these were terrible for other reasons.
This commit is contained in:
parent
05043f97a0
commit
45be146c14
1 changed files with 15 additions and 21 deletions
|
|
@ -19,52 +19,46 @@ pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
|
||||||
#[allow(clippy::error_impl_error)]
|
#[allow(clippy::error_impl_error)]
|
||||||
pub(crate) enum Error {
|
pub(crate) enum Error {
|
||||||
#[cfg(feature = "sqlite")]
|
#[cfg(feature = "sqlite")]
|
||||||
#[error(
|
#[error("error connecting to sqlite database")]
|
||||||
"There was a problem with the connection to the sqlite database: \
|
|
||||||
{source}"
|
|
||||||
)]
|
|
||||||
Sqlite {
|
Sqlite {
|
||||||
#[from]
|
#[from]
|
||||||
source: rusqlite::Error,
|
source: rusqlite::Error,
|
||||||
},
|
},
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
#[error(
|
#[error("error connecting to rocksdb database")]
|
||||||
"There was a problem with the connection to the rocksdb database: \
|
|
||||||
{source}"
|
|
||||||
)]
|
|
||||||
RocksDb {
|
RocksDb {
|
||||||
#[from]
|
#[from]
|
||||||
source: rocksdb::Error,
|
source: rocksdb::Error,
|
||||||
},
|
},
|
||||||
#[error("Could not generate image thumbnail.")]
|
#[error("error generating image thumbnail")]
|
||||||
GenerateThumbnail(#[source] image::error::ImageError),
|
GenerateThumbnail(#[source] image::error::ImageError),
|
||||||
#[error("Could not connect to server: {source}")]
|
#[error("error making request to server")]
|
||||||
Reqwest {
|
Reqwest {
|
||||||
#[from]
|
#[from]
|
||||||
source: reqwest::Error,
|
source: reqwest::Error,
|
||||||
},
|
},
|
||||||
#[error("Could build regular expression: {source}")]
|
#[error("error building regular expression")]
|
||||||
Regex {
|
Regex {
|
||||||
#[from]
|
#[from]
|
||||||
source: regex::Error,
|
source: regex::Error,
|
||||||
},
|
},
|
||||||
#[error("{0}")]
|
#[error("federation request to {0} returned an error")]
|
||||||
Federation(OwnedServerName, RumaError),
|
Federation(OwnedServerName, #[source] RumaError),
|
||||||
#[error("Could not do this io: {source}")]
|
#[error("IO error")]
|
||||||
Io {
|
Io {
|
||||||
#[from]
|
#[from]
|
||||||
source: std::io::Error,
|
source: std::io::Error,
|
||||||
},
|
},
|
||||||
#[error("{0}")]
|
#[error("invalid server response: {0}")]
|
||||||
BadServerResponse(&'static str),
|
BadServerResponse(&'static str),
|
||||||
#[error("{0}")]
|
#[error("config error: {0}")]
|
||||||
BadConfig(&'static str),
|
BadConfig(&'static str),
|
||||||
#[error("{0}")]
|
#[error("invalid data in database: {0}")]
|
||||||
/// Don't create this directly. Use [`Error::bad_database`] instead.
|
/// Don't create this directly. Use [`Error::bad_database`] instead.
|
||||||
BadDatabase(&'static str),
|
BadDatabase(&'static str),
|
||||||
#[error("uiaa")]
|
#[error("UIAA error")]
|
||||||
Uiaa(UiaaInfo),
|
Uiaa(UiaaInfo),
|
||||||
#[error("{0}: {1}")]
|
#[error("invalid request ({0}): {1}")]
|
||||||
BadRequest(ErrorKind, &'static str),
|
BadRequest(ErrorKind, &'static str),
|
||||||
#[error("alias already exists")]
|
#[error("alias already exists")]
|
||||||
AliasConflict,
|
AliasConflict,
|
||||||
|
|
@ -74,11 +68,11 @@ pub(crate) enum Error {
|
||||||
Path(#[from] axum::extract::rejection::PathRejection),
|
Path(#[from] axum::extract::rejection::PathRejection),
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
AdminCommand(&'static str),
|
AdminCommand(&'static str),
|
||||||
#[error("from {0}: {1}")]
|
#[error("error redacting event from {0}: {1}")]
|
||||||
Redaction(OwnedServerName, ruma::canonical_json::RedactionError),
|
Redaction(OwnedServerName, ruma::canonical_json::RedactionError),
|
||||||
#[error("unsupported room version {0}")]
|
#[error("unsupported room version {0}")]
|
||||||
UnsupportedRoomVersion(ruma::RoomVersionId),
|
UnsupportedRoomVersion(ruma::RoomVersionId),
|
||||||
#[error("{0} in {1}")]
|
#[error("inconsistent room state in {1}: {0}")]
|
||||||
InconsistentRoomState(&'static str, ruma::OwnedRoomId),
|
InconsistentRoomState(&'static str, ruma::OwnedRoomId),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue