You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The http::Error type, the higher level error returned from various http builders, is missing a commonly advocated/desired facility for programmatic access. I suspect this was just an oversight of its late addition, not the intent. Currently http::Error is as opaque as any StringError, so for example when building a response via response::Builder, the only way to distinguish between InvalidHeaderName and InvalidStatusCode is by testing Error::to_string, Display or Debug format string.
The only other workaround is to not use the builder types, where that is possible, as for this example using Response::from_parts, etc., but we prefer using the builders for ergonomics.
The text was updated successfully, but these errors were encountered:
Yep, I understand that something like this was necessary for the builders, to return a single error type on the final "building" call. Its just missing some way to test for certain causes, which are already exported, lower level error types, e.g. InvalidHeaderName.
For implementation I think #303 has some advantage, but I'll comment on that there.
The
http::Error
type, the higher level error returned from various http builders, is missing a commonly advocated/desired facility for programmatic access. I suspect this was just an oversight of its late addition, not the intent. Currentlyhttp::Error
is as opaque as anyStringError
, so for example when building a response viaresponse::Builder
, the only way to distinguish betweenInvalidHeaderName
andInvalidStatusCode
is by testingError::to_string
,Display
orDebug
format string.The only other workaround is to not use the builder types, where that is possible, as for this example using
Response::from_parts
, etc., but we prefer using the builders for ergonomics.The text was updated successfully, but these errors were encountered: