-
Notifications
You must be signed in to change notification settings - Fork 8
[CORE-7914] Log an unhandled exception or a user abort before the computation ends #97
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
366add1
[CORE-7914] Log an unhandled exception or a user abort before the com…
Raveline ab30e99
Apply PR suggestions
Raveline e9c4bb4
[EXPERIMENT] Try with catch
Raveline 33b5d3d
Trying something
Raveline 60cd442
Have a dedicated runner that logs on exception
Raveline d7d8cc2
Retrying with MonadMask
Raveline c75ec4f
Use MonadBaseControl IO
Raveline ff00dce
Apply PR suggestions
Raveline cf22190
Bump version and update changelog
Raveline 11a85b4
Provide exceptions logging as a function
Raveline c8f1072
Apply PR suggestions
Raveline d93c066
Add missing dots
Raveline dacd3a5
Change error to exception
arybczak b0f8384
fix changelog
arybczak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,19 +46,25 @@ instance MonadReader r m => MonadReader r (LogT m) where | |||||
| ask = lift ask | ||||||
| local = mapLogT . local | ||||||
|
|
||||||
| -- | Run a 'LogT' computation. | ||||||
| -- | Run a 'LogT' computation and log any uncaught exceptions. | ||||||
| -- | ||||||
| -- Note that in the case of asynchronous/bulk loggers 'runLogT' | ||||||
| -- doesn't guarantee that all messages are actually written to the log | ||||||
| -- once it finishes. Use 'withPGLogger' or 'withElasticSearchLogger' | ||||||
| -- for that. | ||||||
| runLogT :: Text -- ^ Application component name to use. | ||||||
| runLogT :: (MonadBaseControl IO m) | ||||||
| => Text -- ^ Application component name to use. | ||||||
| -> Logger -- ^ The logging back-end to use. | ||||||
| -> LogLevel -- ^ The maximum log level allowed to be logged. | ||||||
| -- Only messages less or equal than this level with be logged. | ||||||
| -> LogT m a -- ^ The 'LogT' computation to run. | ||||||
| -> m a | ||||||
| runLogT component logger maxLogLevel m = runReaderT (unLogT m) LoggerEnv { | ||||||
| runLogT component logger maxLogLevel m = runReaderT | ||||||
| (unLogT $ liftedCatch m (\(SomeException e) -> do | ||||||
| logAttention "Uncaught exception" $ object ["error" .= show e] | ||||||
| E.throw e) | ||||||
|
||||||
| E.throw e) | |
| liftBase $ E.throwIO e) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the haddock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I'm stupid 😬