Exception: Shaf::Errors::UnsupportedMediaTypeError

Inherits:
ServerError show all
Defined in:
lib/shaf/errors.rb

Instance Attribute Summary

Attributes inherited from ServerError

#code, #title

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, request: nil) ⇒ UnsupportedMediaTypeError

Returns a new instance of UnsupportedMediaTypeError.



94
95
96
97
98
# File 'lib/shaf/errors.rb', line 94

def initialize(msg = nil, request: nil)
  content_type = request&.env["CONTENT_TYPE"]
  msg = "Unsupported Media Type#{content_type ? ": #{content_type}" : ""}"
  super(msg, code: "UNSUPPORTED_MEDIA_TYPE", title: "Unsupported media type")
end

Instance Method Details

#http_statusObject



90
91
92
# File 'lib/shaf/errors.rb', line 90

def http_status
  415
end