Exception: Esplanade::Response::BodyIsNotJson

Inherits:
Error
  • Object
show all
Defined in:
lib/esplanade/response/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(request:, status:, body:) ⇒ BodyIsNotJson

Returns a new instance of BodyIsNotJson.



29
30
31
32
33
34
35
36
37
# File 'lib/esplanade/response/error.rb', line 29

def initialize(request:, status:, body:)
  @method = request[:method]
  @path = request[:path]
  @raw_path = request[:raw_path]
  @status = status
  @body = body

  super(to_hash)
end

Instance Method Details

#to_hashObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/esplanade/response/error.rb', line 39

def to_hash
  {
    request:
      {
        method: @method,
        path: @path,
        raw_path: @raw_path
      },
    status: @status,
    body: @body
  }
end