Exception: DilisensePepClient::ConfigurationError

Inherits:
Error
  • Object
show all
Defined in:
lib/dilisense_pep_client/errors.rb

Overview

Raised when there’s a problem with gem configuration Usually means the API key is missing or invalid

Examples:

Common cause - missing API key

# This will raise ConfigurationError if API key not set
client = DilisensePepClient::Client.new

Instance Attribute Summary

Attributes inherited from Error

#context, #error_code, #request_id, #timestamp

Instance Method Summary collapse

Methods inherited from Error

#retryable?, #to_h

Constructor Details

#initialize(message, config_key: nil, config_value: nil, **options) ⇒ ConfigurationError

Returns a new instance of ConfigurationError.



78
79
80
81
82
83
84
85
# File 'lib/dilisense_pep_client/errors.rb', line 78

def initialize(message, config_key: nil, config_value: nil, **options)
  context = {
    config_key: config_key,
    config_value: sanitize_config_value(config_value)
  }.merge(options.fetch(:context, {}))
  
  super(message, error_code: "CONFIG_ERROR", context: context, **options)
end

Instance Method Details

#security_event?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/dilisense_pep_client/errors.rb', line 87

def security_event?
  context[:config_key]&.to_s&.match?(/api_key|secret|token/)
end