Exception: SourceMonitor::Fetching::FetchError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/source_monitor/fetching/fetch_error.rb

Constant Summary collapse

CODE =
"fetch_error"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, original_error: nil, response: nil) ⇒ FetchError

Returns a new instance of FetchError.



10
11
12
13
14
# File 'lib/source_monitor/fetching/fetch_error.rb', line 10

def initialize(message = nil, original_error: nil, response: nil)
  super(message || default_message)
  @original_error = original_error
  @response = response
end

Instance Attribute Details

#original_errorObject (readonly)

Returns the value of attribute original_error.



8
9
10
# File 'lib/source_monitor/fetching/fetch_error.rb', line 8

def original_error
  @original_error
end

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/source_monitor/fetching/fetch_error.rb', line 8

def response
  @response
end

Instance Method Details

#codeObject



16
17
18
# File 'lib/source_monitor/fetching/fetch_error.rb', line 16

def code
  self.class::CODE
end

#http_statusObject



20
21
22
# File 'lib/source_monitor/fetching/fetch_error.rb', line 20

def http_status
  response&.status
end