`HttpError::for_status` asserts when passed a 500-level error
gjcolombo opened this issue · 6 comments
for_status
takes any HTTP status code as an input, but it unconditionally passes the code to for_client_error
, which asserts that the status is 400-level:
dropshot/dropshot/src/error.rs
Lines 204 to 215 in c719b41
dropshot/dropshot/src/error.rs
Lines 143 to 155 in c719b41
I have some error handling code that's tripping this assert: it calls an external service, gets back a Progenitor result, checks to see if the result contains a status, and if so passes that status to HttpError::for_status
to re-encode it as an HTTP error. If there's a more idiomatic way to do this specific conversion, that'd be great too, but it seems strange that for_status
theoretically allows any status but will explode on a subset of them.