Error handling in Functions

I am just starting to convert some dll code into functions. For the most part its going smoothly and I can use standard widgets with no custom code. One aspect I want to make sure I can include is Error Handling. These functions may be called from REST or locally in Epicor. We dont just want to show an error to the user, but to either write it to a log file, or send an error email. I understand how to do this in a Custom Code block, but how do you put a try-catch around a Invoke BO method widget like Update?

One thing i’ve seen people say is to return a true success boolean if it makes it all the way through the Function. If it is false, throw a generic error message from the source that it failed. This isnt ideal since it doesnt show the actual error message, and it would require the error handling to be at the source of the call instead of in the function unless i created a handler function that will call the other functions and handle any errors.

The issue with not having the exact Error message is still there.

You don’t.

This is the way if you want any proper error handling.

I did see that UpdateEXT returns errors that I could utilize, so I’m going to try that route to show if my updates have been successful, then pass that into an Error Function that will handling all the emails and logging.