Exception: Nucleon::Errors::NucleonError
- Inherits:
-
StandardError
- Object
- StandardError
- Nucleon::Errors::NucleonError
- Defined in:
- lib/core/errors.rb
Overview
Base error (based on VagrantError)
Direct Known Subclasses
Instance Attribute Summary collapse
-
#extra_data ⇒ Object
————————————————————————— Property accessor / modifiers.
Class Method Summary collapse
-
.error_key(key = nil, namespace = nil) ⇒ Object
—.
-
.error_message(message) ⇒ Object
—.
-
.error_namespace(namespace) ⇒ Object
—.
-
.status_code(code) ⇒ Object
—.
Instance Method Summary collapse
-
#error_key ⇒ Object
Default.
-
#error_message ⇒ Object
Default.
-
#error_namespace ⇒ Object
Default.
-
#initialize(*args) ⇒ NucleonError
constructor
————————————————————————— Error constructor / destructor.
-
#status_code ⇒ Object
Default.
Constructor Details
#initialize(*args) ⇒ NucleonError
Error constructor / destructor
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/core/errors.rb', line 13 def initialize(*args) key = args.shift if args.first.is_a?(Symbol) = args.shift if args.first.is_a?(Hash) ||= {} @extra_data = .dup [:key] ||= error_key [:namespace] ||= error_namespace [:key] = key if key if [:key] = translate_error() else = end super() end |
Instance Attribute Details
#extra_data ⇒ Object
Property accessor / modifiers
36 37 38 |
# File 'lib/core/errors.rb', line 36 def extra_data @extra_data end |
Class Method Details
.error_key(key = nil, namespace = nil) ⇒ Object
40 41 42 43 |
# File 'lib/core/errors.rb', line 40 def self.error_key(key = nil, namespace = nil) define_method(:error_key) { key } error_namespace(namespace) if namespace end |
.error_message(message) ⇒ Object
48 49 50 |
# File 'lib/core/errors.rb', line 48 def self.() define_method(:error_message) { } end |
.error_namespace(namespace) ⇒ Object
55 56 57 |
# File 'lib/core/errors.rb', line 55 def self.error_namespace(namespace) define_method(:error_namespace) { namespace } end |
.status_code(code) ⇒ Object
62 63 64 |
# File 'lib/core/errors.rb', line 62 def self.status_code(code) define_method(:status_code) { code } end |
Instance Method Details
#error_key ⇒ Object
Default
44 |
# File 'lib/core/errors.rb', line 44 def error_key; nil; end |
#error_message ⇒ Object
Default
51 |
# File 'lib/core/errors.rb', line 51 def ; "No error message"; end |
#error_namespace ⇒ Object
Default
58 |
# File 'lib/core/errors.rb', line 58 def error_namespace; "nucleon.errors"; end |
#status_code ⇒ Object
Default
65 |
# File 'lib/core/errors.rb', line 65 def status_code; 1; end |