Forum OpenACS Q&A: Re: Recommended way to throw errors from functions

Collapse
Posted by Tom Jackson on

I think Jeff Davis recommended to me that I use ad_script_abort, which calls ad_raise, which formats a nice return -code error.

As far as catching errors, I would only do it where it is used as a control structure, not as a nice way to pretty up the error. Catch hides the source of the error, so it should only be used on the smallest possible piece of code. Otherwise debugging an application requires you to either add a bunch of ns_log statements, or remove the catch.