In my opinion, it's a bit naive to expect code to always work in production. There's a reason there are try/catch methods in most programming languages.