Module: T::Private::ErrorHandler

Defined in:
lib/types/private/error_handler.rb

Overview

typed: true frozen_string_literal: true

Class Method Summary collapse

Class Method Details

.handle_call_validation_error(signature, opts = {}) ⇒ Object

Handle a sig call validation failure. This allows users to override the behavior when a sig call fails. If T::Configuration.call_validation_error_handler is unset, this method will call handle_call_validation_error_default.



33
34
35
36
# File 'lib/types/private/error_handler.rb', line 33

def self.handle_call_validation_error(signature, opts={})
  T::Configuration.call_validation_error_handler(signature, opts)
  nil
end

.handle_inline_type_error(type_error) ⇒ Object

Handle a rescued TypeError. This will pass the TypeError to the T::Configuration.inline_type_error_handler so that the user can override error handling if they wish. If no inline_type_error_handler is set, this method will call handle_inline_type_error_default, which raises the error.



9
10
11
12
# File 'lib/types/private/error_handler.rb', line 9

def self.handle_inline_type_error(type_error)
  T::Configuration.inline_type_error_handler(type_error)
  nil
end

.handle_sig_builder_error(error, location) ⇒ Object

Handle a sig declaration failure. This allows users to override the behavior when a sig decl fails. If T::Configuration.sig_builder_error_handler is unset, this method will call handle_sig_builder_error_default.



17
18
19
20
# File 'lib/types/private/error_handler.rb', line 17

def self.handle_sig_builder_error(error, location)
  T::Configuration.sig_builder_error_handler(error, location)
  nil
end

.handle_sig_validation_error(error, opts = {}) ⇒ Object

Handle a sig build validation failure. This allows users to override the behavior when a sig build fails. If T::Configuration.sig_validation_error_handler is unset, this method will call handle_sig_validation_error_default.



25
26
27
28
# File 'lib/types/private/error_handler.rb', line 25

def self.handle_sig_validation_error(error, opts={})
  T::Configuration.sig_validation_error_handler(error, opts)
  nil
end