hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Handle errors better

Open Lukasa opened this issue 11 years ago • 5 comments

Right now if hyper hits an error it just throws exceptions. This leaves the connection in an undefined state, and is fundamentally unusable from then on. We should start handling this better. 'Better' means two things:

  • [ ] Errors on a single stream should cause us to send RST_STREAM frames. Exceptions should still be thrown, but the connection should be OK.
  • [ ] Errors that affect the whole connection should cause us to send GOAWAY with an appropriate error code, and then tear the connection down.

Lukasa avatar Feb 16 '14 10:02 Lukasa

The likely best way to handle this is to wrap affected methods in decorators that catch exceptions. We should provide our own set of exceptions that can carry appropriate HTTP/2.0 failure codes on them. Given such an exception, we can use the appropriate frame and code. Unexpected exceptions will get a generic error code.

Lukasa avatar Feb 16 '14 10:02 Lukasa

Would it be appropriate/preferred to define each error in RFC7540 with a corresponding exception?

fredthomsen avatar Dec 26 '15 08:12 fredthomsen

@fredthomsen Nope, I don't think so. This model is better, I think.

Lukasa avatar Dec 26 '15 10:12 Lukasa

Ok. I'll take a crack at this. I'll start a pull request once I have something.

fredthomsen avatar Dec 28 '15 14:12 fredthomsen

https://github.com/Lukasa/hyper/pull/188

fredthomsen avatar Jan 12 '16 06:01 fredthomsen