Can I write a script to show what is the error on the BI button MS Script I created

Dear all, 

Is there a way to have a short script alone with the BI script to show error message on why my script doesn't work.

In other word, how to trigger error message on a BI script, something related to this code - oBusObj.LastErrorMsg. Correct? Thanks much for help