-
Notifications
You must be signed in to change notification settings - Fork 5
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
Catch exceptions in message formatting #15
Comments
Relevant code in -- | Printing exceptions or other messages is tricky — in the process we
-- can get new exceptions!
--
-- See e.g. https://github.com/feuerbach/tasty/issues/25
formatMessage :: String -> IO String
formatMessage msg = go 3 msg
where
-- to avoid infinite recursion, we introduce the recursion limit
go :: Int -> String -> IO String
go 0 _ = return "exceptions keep throwing other exceptions!"
go recLimit msg = do
mbStr <- try $ evaluate $ force msg
case mbStr of
Right str -> return str
Left e' -> printf "message threw an exception: %s" <$> go (recLimit-1) (show (e' :: SomeException)) |
The commit referenced fixes this issue by copying the |
Sure, I'll export |
Done, |
Same as UnkindPartition/tasty#25. The console reporter deals with it, but not
tasty-html
.The text was updated successfully, but these errors were encountered: