Skip to content

Commit

Permalink
Rebase rust-axum-error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoria-Casasampere-BeeTheData committed Feb 7, 2025
1 parent 36bb429 commit 73be821
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,22 @@ pub trait Payments<E: std::fmt::Debug + Send + Sync + 'static = ()>:
/// GetPaymentMethodById - GET /v71/paymentMethods/{id}
async fn get_payment_method_by_id(
&self,
<<<<<<< HEAD
method: &Method,
host: &Host,
cookies: &CookieJar,
claims: &Self::Claims,
path_params: &models::GetPaymentMethodByIdPathParams,
=======
method: Method,
host: Host,
cookies: CookieJar,
claims: Self::Claims,
path_params: models::GetPaymentMethodByIdPathParams,
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
) -> Result<GetPaymentMethodByIdResponse, E>;

/// Get payment methods.
///
/// GetPaymentMethods - GET /v71/paymentMethods
async fn get_payment_methods(
&self,
<<<<<<< HEAD
method: &Method,
host: &Host,
cookies: &CookieJar,
=======
method: Method,
host: Host,
cookies: CookieJar,
claims: Self::Claims,
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
claims: &Self::Claims,
) -> Result<GetPaymentMethodsResponse, E>;

/// Make a payment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,7 @@ where

let result = api_impl
.as_ref()
<<<<<<< HEAD
<<<<<<< HEAD
.get_payment_method_by_id(&method, &host, &cookies, &path_params)
=======
<<<<<<< HEAD
.get_payment_method_by_id(method.clone(), host.clone(), cookies.clone(), path_params)
=======
.get_payment_method_by_id(method, host, cookies, claims, path_params)
>>>>>>> 99ae104c473 (Implement basic and bearer auth handling)
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
=======
.get_payment_method_by_id(
method.clone(),
host.clone(),
cookies.clone(),
claims,
path_params,
)
>>>>>>> ae676ae13c0 (Rebase with updated error handler)
.get_payment_method_by_id(&method, &host, &cookies, &claims, &path_params)
.await;

let mut response = Response::builder();
Expand Down Expand Up @@ -226,19 +208,7 @@ where

let result = api_impl
.as_ref()
<<<<<<< HEAD
<<<<<<< HEAD
.get_payment_methods(&method, &host, &cookies)
=======
<<<<<<< HEAD
.get_payment_methods(method.clone(), host.clone(), cookies.clone())
=======
.get_payment_methods(method, host, cookies, claims)
>>>>>>> 99ae104c473 (Implement basic and bearer auth handling)
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
=======
.get_payment_methods(method.clone(), host.clone(), cookies.clone(), claims)
>>>>>>> ae676ae13c0 (Rebase with updated error handler)
.get_payment_methods(&method, &host, &cookies, &claims)
.await;

let mut response = Response::builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,11 @@ pub trait Fake<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::ErrorHan
/// TestEndpointParameters - POST /v2/fake
async fn test_endpoint_parameters(
&self,
<<<<<<< HEAD
method: &Method,
host: &Host,
cookies: &CookieJar,
claims: &Self::Claims,
body: &models::TestEndpointParametersRequest,
=======
method: Method,
host: Host,
cookies: CookieJar,
claims: Self::Claims,
body: models::TestEndpointParametersRequest,
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
) -> Result<TestEndpointParametersResponse, E>;

/// To test enum parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,8 @@ where
put(test_body_with_query_params::<I, A, E, C>),
)
.route(
<<<<<<< HEAD
<<<<<<< HEAD
"/v2/fake/hyphenParam/{hyphen_param}",
get(hyphen_param::<I, A, E>),
=======
"/v2/fake/hyphenParam/:hyphen_param",
=======
"/v2/fake/hyphenParam/{hyphen_param}",
>>>>>>> 51f6e61839d (Fix capture group syntax)
get(hyphen_param::<I, A, E, C>),
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
)
.route(
"/v2/fake/inline-additionalProperties",
Expand Down Expand Up @@ -1025,19 +1016,7 @@ where

let result = api_impl
.as_ref()
<<<<<<< HEAD
<<<<<<< HEAD
.test_endpoint_parameters(&method, &host, &cookies, &body)
=======
<<<<<<< HEAD
.test_endpoint_parameters(method.clone(), host.clone(), cookies.clone(), body)
=======
.test_endpoint_parameters(method, host, cookies, claims, body)
>>>>>>> 99ae104c473 (Implement basic and bearer auth handling)
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
=======
.test_endpoint_parameters(method.clone(), host.clone(), cookies.clone(), claims, body)
>>>>>>> ae676ae13c0 (Rebase with updated error handler)
.test_endpoint_parameters(&method, &host, &cookies, &claims, &body)
.await;

let mut response = Response::builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ pub trait Default<E: std::fmt::Debug + Send + Sync + 'static = ()>: super::Error
/// PingGet - GET /ping
async fn ping_get(
&self,
<<<<<<< HEAD
method: &Method,
host: &Host,
cookies: &CookieJar,
=======
method: Method,
host: Host,
cookies: CookieJar,
claims: Self::Claims,
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)
claims: &Self::Claims,
) -> Result<PingGetResponse, E>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,10 @@ where
.map_err(|_| StatusCode::BAD_REQUEST);
};

<<<<<<< HEAD
let result = api_impl.as_ref().ping_get(&method, &host, &cookies).await;
=======
let result = api_impl
.as_ref()
.ping_get(method.clone(), host.clone(), cookies.clone(), claims)
.ping_get(&method, &host, &cookies, &claims)
.await;
>>>>>>> ba70bfea1e1 (Implement basic and bearer auth handling)

let mut response = Response::builder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ pub trait ErrorHandler<E: std::fmt::Debug + Send + Sync + 'static = ()> {
#[tracing::instrument(skip_all)]
async fn handle_error(
&self,
<<<<<<< HEAD
method: &::http::Method,
host: &axum_extra::extract::Host,
cookies: &axum_extra::extract::CookieJar,
=======
method: ::http::Method,
host: axum_extra::extract::Host,
cookies: axum_extra::extract::CookieJar,
>>>>>>> ff8e3cd38e6 (Update deps)
error: E,
) -> Result<axum::response::Response, http::StatusCode> {
tracing::error!("Unhandled error: {:?}", error);
Expand Down

0 comments on commit 73be821

Please sign in to comment.