Catching JSONException not working

I’m using ParseJSON in a Try Catch block that is raising a JSONException, but the catch block isn’t trapping it.

    SomeVar = ParseJSON(GetDataFromDB)
Catch err As JSONException
   MessageBox("Error caught")
End Try

Any ideas what’s wrong?

In some versions of Xojo for some platforms, JSON problems raise InvalidJSONException.

The best way to avoid this is to use JSONItem and not ParseJSON/Dictionaries.

I tried JSONItem but it’s still raising a JSONException in debugger. I’m developing for Windows using Xojo 2022r4.1

Are you running the Debugger with the option “Break On Exceptions”?

If that is the case, the Debugger will stop on the exception line but if you continue then you will see that the try catch works.

yes that’s the issue! Thanks a lot!
ParseJSON works now as intended.
I seem to always forget about the ‘Break on exception’ setting