arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
436 stars 127 forks source link

Fix panic in tokio client when encountering unsupported StatusCode #447

Closed FSMaxB closed 11 months ago

FSMaxB commented 11 months ago

We had a panic in production because of a well known issue in http_types where StatusCode conversion can panic:

A proper fix probably involves switching away from http_types entirely, but I interrupted my initial attempt because that requires changes all over the code base (replacing Request, Method, Url and Body types).

Therefore I'm submitting this quick fix which just avoids the code path with the unwrap.

Checklist

FSMaxB commented 11 months ago

I really don't think there's anything I can/should do about the verify-codegen test failure ...

arlyon commented 11 months ago

I am not sure why the codegen would be causing an issue. I will merge this and solve that separately, TY.

Do you know what status code was failing for you?

FSMaxB commented 11 months ago

Sadly no, because the panic message didn't contain that information. But there's some mention of cloudflare status codes here: https://github.com/http-rs/http-types/issues/507

arlyon commented 11 months ago

Seems like silly behaviour on both sides. I am ok using this as a workaround. Release 0.25.2 is publishing now :)

Edit: live!