Zulip Chat Archive

Stream: lean4

Topic: how to determine the type of an exception?


Scott Morrison (Mar 20 2023 at 22:31):

Say I want to catch typeclass synthesis exceptions, but not others. What is the preferred way to do this? I have:

( e.toMessageData.toString).startsWith "failed to synthesize"

Eric Wieser (Mar 20 2023 at 22:36):

I found myself wanting to do this too

Eric Wieser (Mar 20 2023 at 22:36):

In lean3 we're pretty bad at just blindly catching everything, which makes it hard to debug tactics by throwing errors when things go wrong

Scott Morrison (Mar 20 2023 at 22:51):

Okay, perhaps for now I will add an Exception.isFailedToSynthesize with this implementation so it can be used elsewhere, and we can come up with a better implementation later?

Scott Morrison (Mar 20 2023 at 22:57):

Okay, I've pushed this to !4#2611.


Last updated: Dec 20 2023 at 11:08 UTC