app/extenders/middleware/robustness.rb in cadenero-0.0.2.b2 vs app/extenders/middleware/robustness.rb in cadenero-0.0.2.b3
- old
+ new
@@ -8,9 +8,11 @@
# Rack API call for rescue from the exceptions
def call(env)
@app.call(env)
rescue Apartment::SchemaNotFound => ex
[422, { 'Content-Type' => 'application/json' }, [ {errors: {subdomain:["Invalid subdomain"]}}.to_json ] ] # suppose the message can be safely used
+ rescue ArgumentError => ex
+ [422, { 'Content-Type' => 'application/json' }, [ {errors: {subdomain:["Invalid subdomain"]}}.to_json ] ] # suppose the message can be safely used
rescue SecurityError => ex
[403, { 'Content-Type' => 'application/json' }, [ ex.message ] ]
ensure
env['rack.errors'].write(ex.message) if ex
end
\ No newline at end of file