projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
752d920
)
improve error handling
author
Tom Clegg <tom@clinicalfuture.com>
Fri, 11 Jan 2013 07:27:10 +0000
(23:27 -0800)
committer
Tom Clegg <tom@clinicalfuture.com>
Fri, 11 Jan 2013 07:27:10 +0000
(23:27 -0800)
app/controllers/application_controller.rb
patch
|
blob
|
history
diff --git
a/app/controllers/application_controller.rb
b/app/controllers/application_controller.rb
index f080ae14b6490d809a48e3aa998fbb812bb5061d..5b88277ac9fb687115aa3e61d39d9ce5d27bf20a 100644
(file)
--- a/
app/controllers/application_controller.rb
+++ b/
app/controllers/application_controller.rb
@@
-16,8
+16,13
@@
class ApplicationController < ActionController::Base
:with => :render_not_found
end
- def render_error
- render json: { errors: @object.errors.full_messages }, status: 422
+ def render_error(e)
+ if @object and @object.errors and @object.errors.full_messages
+ errors = @object.errors.full_messages
+ else
+ errors = [e.inspect]
+ end
+ render json: { errors: errors }, status: 422
end
def render_not_found