Module: Foobara::TypeDeclarations::ErrorExtension

Includes:
Concern, WithRegistries
Defined in:
foobara-0.7.3/projects/typesystem/projects/type_declarations/src/error_extension.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from WithRegistries

#handler_for_class, #lookup_absolute_type!, #lookup_type, #lookup_type!, #type_declaration_handler_for, #type_for_declaration, #type_registered?

Methods included from Concern

foobara_class_methods_module_for, foobara_concern?, included

Instance Method Details

#context_type ⇒ Object



54
55
56
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 54

def context_type
  self.class.context_type
end

#context_type_declaration ⇒ Object



58
59
60
61
62
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 58

def context_type_declaration
  # simplecov:disable
  self.class.context_type_declaration
  # simplecov:enable
end

#initialize ⇒ Object



41
42
43
44
45
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 41

def initialize(...)
  super

  validate_context!
end

#validate_context! ⇒ Object



47
48
49
50
51
52
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 47

def validate_context!
  if TypeDeclarations.validate_error_context_enabled?
    # TODO: we need to wrap this in a new error here to communicate what's going on a bit better
    context_type.process_value!(context)
  end
end