Lua error handling prepared to be moved into the proc config instead of global, not finished yet.