Created
January 29, 2013 21:48
-
-
Save LeeXGreen/4668236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error 500 do | |
err = env['sinatra.error'] | |
error_list = err.message | |
error_type = 'code_error' | |
if (err.is_a?(DataMapper::SaveFailureError)) | |
error_list = err.resource.errors.select { |i| true } # all errors | |
error_type = 'save_error' | |
end | |
respond_with(:code => response.status, | |
:error_type => error_type, | |
:error_detail => error_list) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment