Exception: LittleGhost::Providers::HTTPError

Inherits:
LittleGhost::ProviderError show all
Defined in:
lib/little_ghost/providers/http_transport.rb

Overview

Reports an HTTP or network failure from a provider transport.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status: nil, body: nil) ⇒ HTTPError

Creates an error with optional response details.



15
16
17
18
19
# File 'lib/little_ghost/providers/http_transport.rb', line 15

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

Instance Attribute Details

#bodyObject (readonly)

HTTP status and bounded response body, when the server supplied them.



12
13
14
# File 'lib/little_ghost/providers/http_transport.rb', line 12

def body
  @body
end

#statusObject (readonly)

HTTP status and bounded response body, when the server supplied them.



12
13
14
# File 'lib/little_ghost/providers/http_transport.rb', line 12

def status
  @status
end

Instance Method Details

#retryable?Boolean

Indicates whether a provider client may retry the request.

Returns:

  • (Boolean)


22
23
24
# File 'lib/little_ghost/providers/http_transport.rb', line 22

def retryable?
  status.nil? || status == 408 || status == 409 || status == 429 || status >= 500
end