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

Print unhandled exception to stdout depending on verbosity #374

Merged
merged 4 commits into from
Mar 9, 2024

Conversation

cblp
Copy link
Contributor

@cblp cblp commented Feb 11, 2024

No description provided.

@ocramz
Copy link
Collaborator

ocramz commented Feb 12, 2024

Thank you @cblp !

Handler $ \(E.SomeException e) -> do
when (verbose > 0) $
liftIO $
putStrLn $ "Caught and exception of " <> show (typeOf e) <> ": " <> show e
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that it goes to stdout, not stderr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://12factor.net/logs recommend stdout, but I'm not sure

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion; I think stdout is fine too. By the way Caught and exception of looks like a typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo

Copy link
Collaborator

@ocramz ocramz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

@cblp cblp Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows to read record fields in the most natural way (in my taste):

-- line 179
someExceptionHandler Options{verbose} =
    when (verbose > 0) ...

@ocramz
Copy link
Collaborator

ocramz commented Mar 9, 2024

Hi @cblp , there are some small conflicts due to a PR I recently merged. Happy to merge your changes once they are fixed. Thanks again!

@ocramz ocramz self-requested a review March 9, 2024 16:57
Copy link
Collaborator

@ocramz ocramz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a CHANGELOG entry as well?

@ocramz ocramz self-requested a review March 9, 2024 20:36
@ocramz ocramz merged commit 428c2cb into scotty-web:master Mar 9, 2024
6 checks passed
@ocramz ocramz added this to the Release 0.22 milestone Mar 9, 2024
@cblp cblp deleted the print-unhandled-exception branch March 10, 2024 15:06
@cblp
Copy link
Contributor Author

cblp commented Mar 10, 2024

Thanks!

lambdaTotoro added a commit to lambdaTotoro/scotty that referenced this pull request Jun 26, 2024
Improved docs for `verbose` parameter of the `Options` type.
This documents the changes from scotty-web#374 here as well.
@lambdaTotoro lambdaTotoro mentioned this pull request Jun 26, 2024
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

Successfully merging this pull request may close these issues.

3 participants