require "try-catch" try { function() error('oops') end, catch { function(error) print('caught error: ' .. error) end } }