With JError an error message is added. The exception redirects you to a 500 error page. But I see an issue with both: a failing query should not be shown publicly for security reasons.