Class: Committee::ValidationError
- Inherits:
-
Object
- Object
- Committee::ValidationError
- Defined in:
- lib/firetail.rb
Overview
custom error message blog.frankel.ch/structured-errors-http-apis/ www.rfc-editor.org/rfc/rfc7807
Instance Method Summary collapse
Instance Method Details
#error_body ⇒ Object
248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/firetail.rb', line 248 def error_body { errors: [ { type: "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}#{request.env['REQUEST_URI']}", title: id, detail: , status: status } ] } end |
#render ⇒ Object
261 262 263 264 265 266 267 |
# File 'lib/firetail.rb', line 261 def render [ status, { "Content-Type" => "application/json" }, [JSON.generate(error_body)] ] end |