Catch exceptions and return as 500 errors