diff --git a/src/cli/error.rs b/src/cli/error.rs index 87f1f584ef..77b48bf25f 100644 --- a/src/cli/error.rs +++ b/src/cli/error.rs @@ -7,7 +7,8 @@ use opentelemetry::metrics::MetricsError; use opentelemetry::trace::TraceError; use tokio::task::JoinError; -use crate::core::{rest, Errata}; +use crate::core::rest; +use crate::core::valid::ValidationError; #[derive(From, thiserror::Error, Debug)] pub enum Error { @@ -17,9 +18,6 @@ pub enum Error { #[error("Rest Error")] Rest(rest::error::Error), - #[error("Errata Error")] - Errata(Errata), - #[error("Serde Json Error")] SerdeJson(serde_json::Error), @@ -94,15 +92,9 @@ pub enum Error { #[error("Reqwest error")] Reqwest(reqwest::Error), + + #[error("Validation Error : {0}")] + Validation(ValidationError), } pub type Result = std::result::Result; - -impl From for Errata { - fn from(error: rustls::Error) -> Self { - let cli_error = Errata::new("Failed to create TLS Acceptor"); - let message = error.to_string(); - - cli_error.description(message) - } -} diff --git a/src/cli/server/http_1.rs b/src/cli/server/http_1.rs index d23042b768..05188e79ab 100644 --- a/src/cli/server/http_1.rs +++ b/src/cli/server/http_1.rs @@ -7,7 +7,6 @@ use super::server_config::ServerConfig; use crate::cli::{Error, Result}; use crate::core::async_graphql_hyper::{GraphQLBatchRequest, GraphQLRequest}; use crate::core::http::handle_request; -use crate::core::Errata; pub async fn start_http_1( sc: Arc, @@ -31,8 +30,7 @@ pub async fn start_http_1( })) } }); - let builder = hyper::Server::try_bind(&addr) - .map_err(Errata::from)? + let builder = hyper::Server::try_bind(&addr)? .http1_pipeline_flush(sc.app_ctx.blueprint.server.pipeline_flush); super::log_launch(sc.as_ref()); @@ -47,7 +45,7 @@ pub async fn start_http_1( builder.serve(make_svc_single_req).await }; - let result = server.map_err(Errata::from); + let result = server; Ok(result?) } diff --git a/src/cli/server/http_2.rs b/src/cli/server/http_2.rs index ffaa1df0d7..23fe8008e2 100644 --- a/src/cli/server/http_2.rs +++ b/src/cli/server/http_2.rs @@ -12,7 +12,6 @@ use super::server_config::ServerConfig; use crate::cli::{Error, Result}; use crate::core::async_graphql_hyper::{GraphQLBatchRequest, GraphQLRequest}; use crate::core::http::handle_request; -use crate::core::Errata; pub async fn start_http_2( sc: Arc, @@ -60,7 +59,7 @@ pub async fn start_http_2( builder.serve(make_svc_single_req).await }; - let result = server.map_err(Errata::from); + let result = server; Ok(result?) } diff --git a/src/cli/server/http_server.rs b/src/cli/server/http_server.rs index 497a667dcb..240bc88cc1 100644 --- a/src/cli/server/http_server.rs +++ b/src/cli/server/http_server.rs @@ -10,7 +10,6 @@ use crate::cli::telemetry::init_opentelemetry; use crate::cli::Result; use crate::core::blueprint::{Blueprint, Http}; use crate::core::config::ConfigModule; -use crate::core::Errata; pub struct Server { config_module: ConfigModule, @@ -32,7 +31,7 @@ impl Server { /// Starts the server in the current Runtime pub async fn start(self) -> Result<()> { - let blueprint = Blueprint::try_from(&self.config_module).map_err(Errata::from)?; + let blueprint = Blueprint::try_from(&self.config_module)?; let server_config = Arc::new( ServerConfig::new( blueprint.clone(), diff --git a/src/cli/tc.rs b/src/cli/tc.rs index ad953e454e..7c57eaa1ea 100644 --- a/src/cli/tc.rs +++ b/src/cli/tc.rs @@ -18,8 +18,8 @@ use crate::core::config::reader::ConfigReader; use crate::core::error::Error; use crate::core::generator::Generator; use crate::core::http::API_URL_PREFIX; +use crate::core::print_schema; use crate::core::rest::{EndpointSet, Unchecked}; -use crate::core::{print_schema, Errata}; const FILE_NAME: &str = ".tailcallrc.graphql"; const YML_FILE_NAME: &str = ".graphqlrc.yml"; const JSON_FILE_NAME: &str = ".tailcallrc.schema.json"; @@ -60,7 +60,7 @@ pub async fn run() -> Result<(), Error> { if let Some(format) = format { Fmt::display(format.encode(&config_module)?); } - let blueprint = Blueprint::try_from(&config_module).map_err(Errata::from); + let blueprint = Blueprint::try_from(&config_module); match blueprint { Ok(blueprint) => { diff --git a/src/core/error.rs b/src/core/error.rs index 487b53f13c..92ba8f7dfc 100644 --- a/src/core/error.rs +++ b/src/core/error.rs @@ -9,7 +9,6 @@ use super::grpc::error::Error as GrpcError; use super::rest::error::Error as RestError; use super::valid::ValidationError; use crate::cli::error::Error as CLIError; -use crate::core::errata::Errata as ErrataError; #[derive(From, thiserror::Error, Debug)] pub enum Error { @@ -114,9 +113,6 @@ pub enum Error { #[error("Inquire Error")] Inquire(InquireError), - - #[error("Errata Error")] - Errata(ErrataError), } pub mod file {