Exception: Webpipe::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/webpipe/errors.rb

Overview

An error response returned by the WebPipe API. Always carries the server's original error message and the HTTP status code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code:, body: nil) ⇒ ApiError

Returns a new instance of ApiError.



12
13
14
15
16
# File 'lib/webpipe/errors.rb', line 12

def initialize(message, status_code:, body: nil)
  super("[#{status_code}] #{message}")
  @status_code = status_code
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/webpipe/errors.rb', line 10

def body
  @body
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



10
11
12
# File 'lib/webpipe/errors.rb', line 10

def status_code
  @status_code
end