Exception: Tabscanner::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tabscanner/errors/base_error.rb

Overview

Base error class for all Tabscanner-specific errors

This class provides enhanced error handling capabilities including raw response data for debugging purposes when debug mode is enabled.

Examples:

Basic error

raise Tabscanner::Error, "Something went wrong"

Error with raw response for debugging

response = { status: 500, body: '{"error": "Server error"}' }
raise Tabscanner::Error.new("Server error", raw_response: response)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, raw_response: nil) ⇒ Error

Initialize error with message and optional raw response

Parameters:

  • message (String) (defaults to: nil)

    Error message

  • raw_response (Hash, nil) (defaults to: nil)

    Raw HTTP response data for debugging



22
23
24
25
26
27
28
# File 'lib/tabscanner/errors/base_error.rb', line 22

def initialize(message = nil, raw_response: nil)
  @raw_response = raw_response
  
  # Enhance message with debug info if available and debug mode enabled
  enhanced_message = build_enhanced_message(message)
  super(enhanced_message)
end

Instance Attribute Details

#raw_responseHash? (readonly)

Returns Raw HTTP response data for debugging.

Returns:

  • (Hash, nil)

    Raw HTTP response data for debugging



17
18
19
# File 'lib/tabscanner/errors/base_error.rb', line 17

def raw_response
  @raw_response
end