When running a google apps script from a google spreadsheet, if one of the google apis is used incorrectly a red \"butterbar\" error is shown at the top of the spreadsheet.
You can try to have a look to the Base class that gives you the possibility to add alert box or other dialogs to interact with the user of your application if it is bound to a Spreadsheet (for example msgBox()). For a DocumentApp use the Ui class to interact with its interface.
I never tried but if you use a try...catch structure with a throw statement it can also work.
Cheers
Nicolas