Exception: Webgen::RenderError
- Defined in:
- lib/webgen/error.rb
Overview
This error is raised when an error condition occurs during rendering of a node.
Instance Attribute Summary collapse
-
#error_path ⇒ Object
The path of the file where the error happened.
-
#line ⇒ Object
The line number in the
error_path
where the errror happened.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(msg_or_error, location = nil, path = nil, error_path = nil, line = nil) ⇒ RenderError
constructor
Create a new RenderError.
-
#message ⇒ Object
:nodoc:.
Methods inherited from Error
Constructor Details
#initialize(msg_or_error, location = nil, path = nil, error_path = nil, line = nil) ⇒ RenderError
Create a new RenderError.
78 79 80 81 82 |
# File 'lib/webgen/error.rb', line 78 def initialize(msg_or_error, location = nil, path = nil, error_path = nil, line = nil) super(msg_or_error, location, path) @error_path = error_path || (Exception === msg_or_error ? self.class.error_file(msg_or_error) : nil) @line = line || (Exception === msg_or_error ? self.class.error_line(msg_or_error) : nil) end |
Instance Attribute Details
#error_path ⇒ Object
The path of the file where the error happened. This can be different from #path (e.g. a page file is rendered but the error happens in a used template).
72 73 74 |
# File 'lib/webgen/error.rb', line 72 def error_path @error_path end |
#line ⇒ Object
The line number in the error_path
where the errror happened.
75 76 77 |
# File 'lib/webgen/error.rb', line 75 def line @line end |
Instance Method Details
#message ⇒ Object
:nodoc:
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/webgen/error.rb', line 84 def # :nodoc: msg = 'Error' msg << " at #{@location}" if @location if @error_path msg += " in <#{@error_path}" msg += ":~#{@line}" if @line msg += ">" end msg << ' while rendering' msg << (!@path.to_s.empty? ? " <#{@path}>" : ' the website') msg << ":\n " << super(true) end |