inhabitedtype / faraday

Serialization library built for speed and memory efficiency
Other
134 stars 20 forks source link

Writing can raise `Failure _` #78

Open reynir opened 1 year ago

reynir commented 1 year ago

When writing to a closed Faraday.t an exception Failure "cannot write to closed writer" is raised. I am observing this exception from Httpaf.Body.write_string, and I'm wary of catching all Failures. Could a more precise exception be used?

https://github.com/inhabitedtype/faraday/blob/c66fc020fdc2327556c36fc1e912524b427d7da8/lib/faraday.ml#L193-L195