Exception: Tramway::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Tramway::Error
- Defined in:
- lib/tramway/error.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args, plugin: nil, method: nil, message: nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #properties ⇒ Object
Constructor Details
#initialize(*args, plugin: nil, method: nil, message: nil) ⇒ Error
Returns a new instance of Error.
4 5 6 7 8 9 10 |
# File 'lib/tramway/error.rb', line 4 def initialize(*args, plugin: nil, method: nil, message: nil) @properties = {} @properties[:plugin] = plugin @properties[:method] = method @properties[:message] = super(*args) end |
Class Method Details
.raise_error(*coordinates, **options) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/tramway/error.rb', line 21 def raise_error(*coordinates, **) @errors ||= YAML.load_file("#{Tramway::Core.root}/yaml/errors.yml").with_indifferent_access error = @errors.dig(*coordinates) .each do |pair| error.gsub!("%{#{pair[0]}}", pair[1].to_s) end raise error end |
Instance Method Details
#message ⇒ Object
12 13 14 |
# File 'lib/tramway/error.rb', line 12 def "Plugin: #{@properties[:plugin]}; Method: #{@properties[:method]}; Message: #{@properties[:message]}" end |
#properties ⇒ Object
16 17 18 |
# File 'lib/tramway/error.rb', line 16 def properties @properties ||= {} end |