Exception: Foobara::Entity::NotFoundError
Instance Attribute Summary
#backtrace_when_initialized, #backtrace_when_raised, #context, #error_key, #is_fatal, #message
Class Method Summary
collapse
Instance Method Summary
collapse
category, fatal?, #initialize
#==, abstract, abstract?, category, context, #eql?, fatal?, #fatal?, foobara_manifest, #initialize, #key, message, path, #prepend_path!, runtime_path, symbol, to_h, #to_h, types_depended_on
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Class Method Details
.data_path ⇒ Object
45
46
47
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 45
def data_path
nil
end
|
.for(criteria, entity_class: self.entity_class, data_path: self.data_path || "") ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 34
def for(criteria, entity_class: self.entity_class, data_path: self.data_path || "")
message = "Could not find #{entity_class} for #{criteria}"
context = {
entity_class: entity_class.full_entity_name,
criteria:,
data_path: data_path.to_s
}
new(context:, message:)
end
|
.not_found_error_class_name(data_path) ⇒ Object
5
6
7
8
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 5
def not_found_error_class_name(data_path)
error_class_name = data_path.path.map { |part| part == :"#" ? "Collection" : Util.classify(part) }.join
"#{error_class_name}NotFoundError"
end
|
.subclass(mod, entity_class, data_path) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 10
def subclass(mod, entity_class, data_path)
error_class_name = not_found_error_class_name(data_path)
Util.make_class("#{mod.name}::#{error_class_name}", self) do
singleton_class.define_method :data_path do
data_path
end
singleton_class.define_method :entity_class do
entity_class
end
singleton_class.define_method :context_type_declaration do
{
entity_class: :string, criteria: :duck, data_path: :string }
end
end
end
|
Instance Method Details
#criteria ⇒ Object
58
59
60
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 58
def criteria
context[:criteria]
end
|
#data_path ⇒ Object
62
63
64
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 62
def data_path
context[:data_path]
end
|
#entity_class ⇒ Object
66
67
68
|
# File 'foobara-0.0.110/projects/entity/src/not_found_error.rb', line 66
def entity_class
context[:entity_class]
end
|