I’m an old programmer. Yes, that is me telling you to get off my lawn. I’ve seen a lot of changes to programming language structures over my career, but I think the most useful one is the try/catch construct (try/finally gets an honorable mention, but try/catch is the star of the show today). One of the things I missed when I moved into ServiceNow, was the try/catch. Somewhere (or some when) I noticed that the try/catch was available as an option.
Even though try/catch was available I noticed that neither the community or ServiceNow itself seemed to use it as often as they should. I’m not going to go into long boring detail of how to use try/catch. There are an almost unlimited number of resources on the internet that will show you how to code the try/catch structures. What I want to do is encourage the wider adoption of the try/catch in the ServiceNow coding platform.
The try/catch structure makes it easier to diagnose errors and ensures consistent code execution. Let’s use it more liberally in our client scripts, business rules and script includes. Your users will thank you, and future maintenance programmers will thank you.