diff --git a/src/client/base/tokio.rs b/src/client/base/tokio.rs index 57c0f0dc9..3ba3ae73f 100644 --- a/src/client/base/tokio.rs +++ b/src/client/base/tokio.rs @@ -160,7 +160,12 @@ async fn send_inner( StripeError::from(e.error) }) .unwrap_or_else(StripeError::from); - last_status = Some(status.into()); + last_status = Some( + // NOTE: StatusCode::from can panic here, so fall back to InternalServerError + // see https://github.com/http-rs/http-types/blob/ac5d645ce5294554b86ebd49233d3ec01665d1d7/src/hyperium_http.rs#L20-L24 + StatusCode::try_from(u16::from(status)) + .unwrap_or(StatusCode::InternalServerError), + ); last_retry_header = retry; continue; }