The problem is that I can't accept an exception here.

I'm running the script from the context of an application.

Does anyone know how to check?