Exception: Esplanade::Response::Invalid

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

Instance Method Summary collapse

Constructor Details

#initialize(request:, status:, body:, error:) ⇒ Invalid

Returns a new instance of Invalid.



54
55
56
57
58
59
60
61
62
63
# File 'lib/esplanade/response/error.rb', line 54

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

  super(to_hash)
end

Instance Method Details

#to_hashObject



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/esplanade/response/error.rb', line 65

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