Class: DTK::DSL::Template::Parsing::ParsingError
- Inherits:
-
Error::Usage
- Object
- GlobalForDSL::ErrorUsage
- Error::Usage
- DTK::DSL::Template::Parsing::ParsingError
- Defined in:
- lib/dsl/template/parsing/parsing_error.rb,
lib/dsl/template/parsing/parsing_error/subclasses.rb
Direct Known Subclasses
Defined Under Namespace
Classes: MissingKeyValue, WrongObjectType
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error_msg, opts = {}) ⇒ ParsingError
constructor
opts can have keys :file_obj :qualified_key.
Constructor Details
#initialize(error_msg, opts = {}) ⇒ ParsingError
opts can have keys
:file_obj
:qualified_key
28 29 30 31 32 33 34 |
# 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 |
Class Method Details
.error_class?(args) ⇒ Boolean
36 37 38 39 40 41 42 43 44 45 46 |
# 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 |