Exception: Glyph::MacroError

Inherits:
Error
  • Object
show all
Includes:
Utils
Defined in:
lib/glyph.rb

Overview

A macro error.

Direct Known Subclasses

MutualInclusionError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#clean_xml_document, #complex_output?, #current_output_setting, #debug, #error, #file_copy, #file_load, #file_write, #info, #load_files_from_dir, #macro_alias?, #macro_aliases_for, #macro_definition_for, #macro_eq?, #msg, #multiple_output_files?, #project?, #run_external_command, #titled_sections, #warning, #with_files_from, #yaml_dump, #yaml_load

Constructor Details

#initialize(message, macro) ⇒ MacroError

Initializes a new Glyph::MacroError

Parameters:

  • message (String)

    the error message

  • macro (Glyph::Macro)

    the macro that caused the error



57
58
59
60
# File 'lib/glyph.rb', line 57

def initialize(message, macro)
	@macro = macro
	super(message)
end

Instance Attribute Details

#macroObject (readonly)

Returns the value of attribute macro.



52
53
54
# File 'lib/glyph.rb', line 52

def macro
  @macro
end

Instance Method Details

#displayObject

Displays the error message, source, path and node value (if debugging)



63
64
65
66
67
68
# File 'lib/glyph.rb', line 63

def display
	warning exception.message
	path = @macro.path.blank? ? "" : "\n   path: #{@macro.path}"
	msg "   source: #{@macro.source_name}#{path}"
	msg "#{"-"*54}\n#{@macro.node.to_s.gsub(/\t/, ' ')}\n#{"-"*54}" if Glyph.debug?
end