Skip to content

Commit

Permalink
Fix #5978 Accommodate pretty exceptions with --file-watch
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Dec 20, 2022
1 parent 4a5b13f commit ff1acd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Other enhancements:

Bug fixes:

* `stack build` with `--file-watch` or `--file-watch-poll` outputs 'pretty'
error messages, as intended. See
[#5978](https://github.com/commercialhaskell/stack/issues/5978).

## v2.9.3

Release notes:
Expand Down
17 changes: 9 additions & 8 deletions src/Stack/FileWatch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ fileWatchConf cfg inner =
-- https://github.com/commercialhaskell/stack/issues/822
atomically $ writeTVar dirtyVar False

prettyInfo $
case eres of
Left e ->
let theStyle = case fromException e of
Just ExitSuccess -> Good
_ -> Error
in style theStyle $ fromString $ displayException e
_ -> style Good "Success! Waiting for next file change."
case eres of
Left e ->
case fromException e of
Just ExitSuccess ->
prettyInfo $ style Good $ fromString $ displayException e
_ -> case fromException e :: Maybe PrettyException of
Just pe -> prettyError $ pretty pe
_ -> prettyInfo $ style Error $ fromString $ displayException e
_ -> prettyInfo $ style Good "Success! Waiting for next file change."

logInfo "Type help for available commands. Press enter to force a rebuild."

0 comments on commit ff1acd5

Please sign in to comment.