It's possible. Using a `try except` construct.
More precisely... Maybe I'm wrong. I googled it and couldn't find how it's done in Lua; perhaps it's done differently.
Error handling is definitely implemented by Durman in the NHF mod scripts. Try downloading it and take a look at how it's done. But `try` is likely used.