@@ -62,7 +62,8 @@ impl Client {
6262 . http_client
6363 . get ( format ! ( "{base_url}/submissions/count" ) )
6464 . send ( )
65- . await ?;
65+ . await ?
66+ . error_for_status ( ) ?;
6667 let bytes = resp. bytes ( ) . await ?;
6768 let body = serde_json:: from_slice ( & bytes) ?;
6869
@@ -92,7 +93,8 @@ impl Client {
9293 . headers ( otel_trace_carrier. try_into ( ) . unwrap_or_default ( ) )
9394 . json ( submission)
9495 . send ( )
95- . await ?;
96+ . await ?
97+ . error_for_status ( ) ?;
9698 let bytes = resp. bytes ( ) . await ?;
9799 let body = serde_json:: from_slice ( & bytes) ?;
98100 Ok ( body)
@@ -118,7 +120,8 @@ impl Client {
118120 . http_client
119121 . get ( format ! ( "{base_url}/submissions/{submission_id}" ) )
120122 . send ( )
121- . await ?;
123+ . await ?
124+ . error_for_status ( ) ?;
122125 let bytes = resp. bytes ( ) . await ?;
123126 let body = serde_json:: from_slice ( & bytes) ?;
124127 Ok ( body)
@@ -143,7 +146,8 @@ impl Client {
143146 "{base_url}/submissions/lookup_id_by_prefix/{prefix}"
144147 ) )
145148 . send ( )
146- . await ?;
149+ . await ?
150+ . error_for_status ( ) ?;
147151 let bytes = resp. bytes ( ) . await ?;
148152 let body = serde_json:: from_slice ( & bytes) ?;
149153 Ok ( body)
@@ -183,14 +187,14 @@ pub enum InternalProducerClientError {
183187impl InternalProducerClientError {
184188 pub fn is_ephemeral ( & self ) -> bool {
185189 match self {
186- // NOTE: In the case of an ungraceful restart, this case might theoretically trigger.
190+ // In the case of an ungraceful restart, this case might theoretically trigger.
187191 // So even cleaner would be a tiny retry loop for this special case.
188192 // However, we certainly **do not** want to wait multiple minutes before returning.
189193 Self :: ResponseDecodingError ( _) => false ,
190- // NOTE: reqwest doesn't make this very easy as it has a single error typed used for _everything_
194+ // Reqwest doesn't make this very easy as it has a single error typed used for _everything_
191195 // Maybe a different HTTP client library is nicer in this regard?
192196 Self :: HTTPClientError ( inner) => {
193- inner. is_connect ( ) || inner. is_timeout ( ) || inner. is_decode ( )
197+ inner. is_status ( ) || inner . is_connect ( ) || inner. is_timeout ( ) || inner. is_decode ( )
194198 }
195199 }
196200 }
0 commit comments