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

defaultShouldDisplayException hides exceptions from writing invalid characters to stdout. #883

Open
torgeirsh opened this issue Apr 22, 2022 · 0 comments

Comments

@torgeirsh
Copy link

Consider this contrived program:

main = do
    e <- try $ putStrLn "ø"
    case e of
        Left (e :: SomeException) -> do
            print e
            print $ defaultShouldDisplayException e
        Right _ -> pure ()

The output when stdout has a character encoding that can represent "ø" is:

<stdout>: commitBuffer: invalid argument (invalid character)
False

The result is that warp quietly terminates requests that attempt to log a message that contains an invalid character, instead of printing out an error message. The relevant case in defaultShouldDisplayException's implementation seems to be:

    | Just (ioeGetErrorType -> et) <- fromException se
        , et == ResourceVanished || et == InvalidArgument = False

Is it necessary to hide all IO exceptions of type InvalidArgument, or could it be more specific about what to hide?

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

1 participant