class DTK::DSL::Template::Parsing::ParsingError

Public Class Methods

error_class?(args) click to toggle source
# File lib/dsl/template/parsing/parsing_error.rb, line 36
def self.error_class?(args)
  if args.first.kind_of?(Symbol)
    begin
      const_get(args.first.to_s)
    rescue
      nil
    end
  elsif args.first.kind_of?(self)
    args.first
  end
end
new(error_msg, opts = {}) click to toggle source

opts can have keys

:file_obj
:qualified_key
Calls superclass method
# File lib/dsl/template/parsing/parsing_error.rb, line 28
def initialize(error_msg, opts = {})
  @file_ref      = FileParser.file_ref_in_error(opts[:file_obj])
  @qualified_key = opts[:qualified_key]
  # TODO: later enhancment can use @qualified_key to find line numbers in yaml file
  key_ref = @qualified_key ? " under key '#{@qualified_key}'" : ''
  super("DTK parsing error#{key_ref}#{@file_ref}:\n  #{error_msg}")
end