1414
1515use rabbitmq_http_client:: error:: Error as ApiClientError ;
1616use rabbitmq_http_client:: { blocking_api:: HttpClientError , responses:: HealthCheckFailureDetails } ;
17- use reqwest:: blocking:: Response ;
18- use reqwest:: { header:: InvalidHeaderValue , StatusCode } ;
17+ use reqwest:: {
18+ header:: { HeaderMap , InvalidHeaderValue } ,
19+ StatusCode ,
20+ } ;
21+ use url:: Url ;
1922
2023#[ derive( thiserror:: Error , Debug ) ]
2124pub enum CommandRunError {
@@ -24,12 +27,16 @@ pub enum CommandRunError {
2427 #[ error( "API responded with a client error: status code of {status_code}" ) ]
2528 ClientError {
2629 status_code : StatusCode ,
27- response : Option < Response > ,
30+ url : Option < Url > ,
31+ body : Option < String > ,
32+ headers : Option < HeaderMap > ,
2833 } ,
2934 #[ error( "API responded with a client error: status code of {status_code}" ) ]
3035 ServerError {
3136 status_code : StatusCode ,
32- response : Option < Response > ,
37+ url : Option < Url > ,
38+ body : Option < String > ,
39+ headers : Option < HeaderMap > ,
3340 } ,
3441 #[ error( "Health check failed" ) ]
3542 HealthCheckFailed {
@@ -52,18 +59,18 @@ pub enum CommandRunError {
5259impl From < HttpClientError > for CommandRunError {
5360 fn from ( value : HttpClientError ) -> Self {
5461 match value {
55- ApiClientError :: ClientErrorResponse { status_code, response , .. } => {
56- Self :: ClientError { status_code, response }
62+ ApiClientError :: ClientErrorResponse { status_code, url , body , headers , .. } => {
63+ Self :: ClientError { status_code, url , body , headers }
5764 } ,
58- ApiClientError :: ServerErrorResponse { status_code, response , .. } => {
59- Self :: ServerError { status_code, response }
65+ ApiClientError :: ServerErrorResponse { status_code, url , body , headers , .. } => {
66+ Self :: ServerError { status_code, url , body , headers }
6067 } ,
6168 ApiClientError :: HealthCheckFailed { path, details, status_code } => {
6269 Self :: HealthCheckFailed { health_check_path : path, details, status_code }
6370 } ,
6471 ApiClientError :: NotFound => Self :: NotFound ,
6572 ApiClientError :: MultipleMatchingBindings => Self :: ConflictingOptions {
66- message : "multiple bindings match, cannot determing which binding to delete without explicitly provided binding properties" . to_owned ( )
73+ message : "multiple bindings match, cannot determine which binding to delete without explicitly provided binding properties" . to_owned ( )
6774 } ,
6875 ApiClientError :: InvalidHeaderValue { error } => {
6976 Self :: InvalidHeaderValue { error }
0 commit comments