-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stack]: redesign errors - 1: drop anyhow (#2155)
- Loading branch information
1 parent
5218d50
commit 5f4b225
Showing
70 changed files
with
857 additions
and
376 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,100 @@ | ||
use crate::core::Errata; | ||
use std::string::FromUtf8Error; | ||
|
||
impl From<rustls::Error> for Errata { | ||
fn from(error: rustls::Error) -> Self { | ||
let cli_error = Errata::new("Failed to create TLS Acceptor"); | ||
let message = error.to_string(); | ||
use derive_more::From; | ||
use inquire::InquireError; | ||
use opentelemetry::logs::LogError; | ||
use opentelemetry::metrics::MetricsError; | ||
use opentelemetry::trace::TraceError; | ||
use tokio::task::JoinError; | ||
|
||
cli_error.description(message) | ||
} | ||
use crate::core::rest; | ||
use crate::core::valid::ValidationError; | ||
|
||
#[derive(From, thiserror::Error, Debug)] | ||
pub enum Error { | ||
#[error("Metrics Error")] | ||
Metrics(MetricsError), | ||
|
||
#[error("Rest Error")] | ||
Rest(rest::error::Error), | ||
|
||
#[error("Serde Json Error")] | ||
SerdeJson(serde_json::Error), | ||
|
||
#[error("IO Error")] | ||
IO(std::io::Error), | ||
|
||
#[error("Telemetry Trace Error : {0}")] | ||
TelemetryTrace(String), | ||
|
||
#[error("Failed to send message")] | ||
MessageSendFailure, | ||
|
||
#[error("Hyper Error")] | ||
Hyper(hyper::Error), | ||
|
||
#[error("Rustls Error")] | ||
Rustls(rustls::Error), | ||
|
||
#[error("Join Error")] | ||
Join(JoinError), | ||
|
||
#[error("Opentelemetry Global Error")] | ||
OpentelemetryGlobal(opentelemetry::global::Error), | ||
|
||
#[error("Trace Error")] | ||
Trace(TraceError), | ||
|
||
#[error("Log Error")] | ||
Log(LogError), | ||
|
||
#[error("Utf8 Error")] | ||
Utf8(FromUtf8Error), | ||
|
||
#[error("Inquire Error")] | ||
Inquire(InquireError), | ||
|
||
#[error("Serde Yaml Error")] | ||
SerdeYaml(serde_yaml::Error), | ||
|
||
#[error("Invalid Header Name")] | ||
InvalidHeaderName(hyper::header::InvalidHeaderName), | ||
|
||
#[error("Invalid Header Value")] | ||
InvalidHeaderValue(hyper::header::InvalidHeaderValue), | ||
|
||
#[error("rquickjs Error")] | ||
RQuickjs(rquickjs::Error), | ||
|
||
#[error("Trying to reinitialize an already initialized QuickJS runtime")] | ||
ReinitializeQuickjsRuntime, | ||
|
||
#[error("Runtime not initialized")] | ||
RuntimeNotInitialized, | ||
|
||
#[error("Deserialize Failed")] | ||
DeserializeFailed, | ||
|
||
#[error("Not a function error")] | ||
InvalidFunction, | ||
|
||
#[error("Init Process Observer Error")] | ||
InitProcessObserver, | ||
|
||
#[error("JS Runtime is stopped")] | ||
JsRuntimeStopped, | ||
|
||
#[error("Rustls internal error")] | ||
RustlsInternal, | ||
|
||
#[error("Reqwest middleware error")] | ||
ReqwestMiddleware(reqwest_middleware::Error), | ||
|
||
#[error("Reqwest error")] | ||
Reqwest(reqwest::Error), | ||
|
||
#[error("Validation Error : {0}")] | ||
Validation(ValidationError<std::string::String>), | ||
} | ||
|
||
pub type Result<A> = std::result::Result<A, Error>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.