Exception: Woods::Unblocked::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/woods/unblocked/client.rb

Overview

API error carrying the HTTP status code, so callers can branch on status (e.g. treat a 404 on delete as “already gone”) instead of matching message strings. Subclasses Woods::Error, so existing rescue Woods::Error sites keep working unchanged.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status:) ⇒ ApiError

Returns a new instance of ApiError.

Parameters:

  • message (String)

    Error message

  • status (Integer)

    HTTP status code — required, because callers branch on it (a nil status would silently miss every status check)



22
23
24
25
# File 'lib/woods/unblocked/client.rb', line 22

def initialize(message, status:)
  super(message)
  @status = Integer(status)
end

Instance Attribute Details

#statusInteger (readonly)

Returns HTTP status code of the failed response.

Returns:

  • (Integer)

    HTTP status code of the failed response



17
18
19
# File 'lib/woods/unblocked/client.rb', line 17

def status
  @status
end