There have been some really good, helpful posts on this already:
https://community.intersystems.com/post/robust-error-handling-and-cleanu...
https://community.intersystems.com/post/registering-new-error-code-and-e...
Error handling refers to the response and recovery procedures from error conditions present in a software application. It is the process comprised of anticipation, detection and resolution of application errors, programming errors or communication errors.