Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warp: Use custom exception on listen socket closure #873

Open
shlevy opened this issue Mar 15, 2022 · 3 comments
Open

warp: Use custom exception on listen socket closure #873

shlevy opened this issue Mar 15, 2022 · 3 comments

Comments

@shlevy
Copy link

shlevy commented Mar 15, 2022

Currently, my custom uncaught exception logger needs:

onException Nothing e
  | Just (ioeGetErrorType -> et) <- fromException e
  , et == ResourceVanished || et == InvalidArgument = pure ()

in order to avoid logging the invalid argument error that results from the listen socket being closed (to start graceful shutdown). It would be nice to have a custom exception type passed to the uncaught exception handler in this case, as it's an internal implementation detail if there could be other cases of ResourceVanished or InvalidArgument thrown prior to the construction of the Request which we actually do want to log.

@snoyberg
Copy link
Member

Making such a change would end up silently breaking lots of existing code that's doing exactly what you've done here.

@shlevy
Copy link
Author

shlevy commented Mar 15, 2022

Hmm so options here:

  1. Do nothing
  2. Accept the breakage
  3. Have some new interface generalizing setOnException with a richer context

Probably 1 is the right answer for the library but I wouldn't say no to 3.

@snoyberg
Copy link
Member

An option (4) that I think would work here: provide predicate functions that test for the common cases people care about, e.g. isListenSocketClosedException :: SomeException -> Bool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants