Module: Foobara::TypeDeclarations::ErrorExtension

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

Defined Under Namespace

Modules: ClassMethods Classes: NoContextTypeSetError

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_typeObject



70
71
72
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 70

def context_type
  self.class.context_type
end

#context_type_declarationObject



74
75
76
77
78
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 74

def context_type_declaration
  # :nocov:
  self.class.context_type_declaration
  # :nocov:
end

#initializeObject



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

def initialize(...)
  super

  validate_context!
end

#validate_context!Object



63
64
65
66
67
68
# File 'projects/typesystem/projects/type_declarations/src/error_extension.rb', line 63

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