Exception: Ghostcrawl::ScrapeError

Inherits:
GhostcrawlError show all
Defined in:
lib/ghostcrawl/errors.rb

Overview

Raised when a request succeeds at the transport layer (HTTP 200) but the target page could not be scraped — the RESULT channel. Carries the canonical result-error code (e.g. "blocked", "captcha_required") plus the target's own HTTP status when one is available.

Instance Attribute Summary collapse

Attributes inherited from GhostcrawlError

#body, #code, #request_id, #retryable, #status_code

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code: 200, body: nil, code: nil, retryable: false, request_id: nil, target_status: nil) ⇒ ScrapeError

Returns a new instance of ScrapeError.



53
54
55
56
57
58
# File 'lib/ghostcrawl/errors.rb', line 53

def initialize(message, status_code: 200, body: nil, code: nil, retryable: false,
               request_id: nil, target_status: nil)
  super(message, status_code: status_code, body: body, code: code,
                 retryable: retryable, request_id: request_id)
  @target_status = target_status
end

Instance Attribute Details

#target_statusInteger? (readonly)

Returns the target site's HTTP status, when reported.

Returns:

  • (Integer, nil)

    the target site's HTTP status, when reported



51
52
53
# File 'lib/ghostcrawl/errors.rb', line 51

def target_status
  @target_status
end