Exception: LittleGhost::Providers::HTTPError

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

Overview

Reports a bounded HTTP or network failure from a provider connection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Captures a provider failure without retaining an unbounded response.



11
12
13
14
15
# File 'lib/little_ghost/providers/base.rb', line 11

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

Instance Attribute Details

#bodyObject (readonly)

HTTP status, when a response was received, and the bounded response body.



8
9
10
# File 'lib/little_ghost/providers/base.rb', line 8

def body
  @body
end

#statusObject (readonly)

HTTP status, when a response was received, and the bounded response body.



8
9
10
# File 'lib/little_ghost/providers/base.rb', line 8

def status
  @status
end

Instance Method Details

#retryable?Boolean

Whether retrying the same provider request may succeed.

Returns:

  • (Boolean)


18
19
20
# File 'lib/little_ghost/providers/base.rb', line 18

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