Sign up to receive SuiteScript examples and advice directly in your email inbox.

Exception Handling for Newbies

Created: September 27, 2017

Near the tail end of this week's video, I briefly mentioned the concept of "Exception Handling", which is an incredibly important topic for SuiteScript developers to understand. Knowing how to appropriately throw and manage Exceptions is critical to the stability and ease of troubleshooting your SuiteScript will inevitably need.

JavaScript (and thus SuiteScript) has an Exception system that works just like many other popular languages. We use exceptions to indicate that something has gone desperately wrong in our script, and action is needed to either recover from the error or exit altogether.

If you aren't familiar with Exceptions at all, or need to learn how they work in JavaScript, this MDN article is a great starting point.