Closed andreasabel closed 2 months ago
The problem could be that the parser only catches IOError
s, but readFile
throws a custom exception DecodingError :: ReadException
.
https://github.com/agda/agda/blob/20ad6b5d02f7a647e83cc493d8b4e11e22cac8c9/src/full/Agda/Syntax/Parser.hs#L86-L96
We could simply throw a userError
rather than our hand-rolled DecodingError
, since we never catch the latter.
We are also suffering from this regression in base-4.20
concerning exception printing:
We could simply throw a
userError
rather than our hand-rolledDecodingError
, since we never catch the latter.
This is actually how it used to be in 8d75579c41308fc33671a96235a83f72add316c2 but it was changed in 71ad0f1de7aaaa4296364d7cef1d0e153e987bcf. Maybe better not going back... I noticed we can use the backtraceDesired
feature to turn off the backtrace for the DecodingError
exception. (It will still add some annoying trailing whitespace, see my report of GHC issue 25052.)
https://github.com/agda/agda/blob/8c413d4d5cc2db6c7ca309667b4c9fb1c6666bf4/src/full/Agda/Utils/IO/UTF8.hs#L70 This will produce for issue #4506:
I recall discussing with @nad the choice or error reporting here, we might want to return
Nothing
here instead and let Agda handle it further up, or catch this exception and print it without a stack trace.