Has anyone managed to successfully modify the SetTrap routine?

I have a scenario where I want to catch the error dialog, print the text inside the dialog, and then proceed with the script.

The only options that appear to be available through SetTrap are handling the error dialog without saying anything, or raising an exception with a static error message.

I tried modifying the DialogBox Exists method, bExists property, and the PushButton Click method, but without any success.