Sha256: 2e1bc0e25c934258f25b7e80f451b47c6a0a94257b481ff575c50c9398420c20
Contents?: true
Size: 836 Bytes
Versions: 48
Compression:
Stored size: 836 Bytes
Contents
# frozen_string_literal: true class Tramway::Error < RuntimeError def initialize(*args, plugin: nil, method: nil, message: nil) @properties = {} @properties[:plugin] = plugin @properties[:method] = method @properties[:message] = message super(*args) end def message "Plugin: #{@properties[:plugin]}; Method: #{@properties[:method]}; Message: #{@properties[:message]}" end def properties @properties ||= {} end class << self def raise_error(*coordinates, **options) @errors ||= YAML.load_file("#{Tramway::Core.root}/yaml/errors.yml").with_indifferent_access error = @errors.dig(*coordinates) raise 'Error is not defined in YAML' unless error options.each do |pair| error.gsub!("%{#{pair[0]}}", pair[1].to_s) end raise error end end end
Version data entries
48 entries across 48 versions & 1 rubygems