Exception: Lilac::CLI::BuildError
- Inherits:
-
StandardError
- Object
- StandardError
- Lilac::CLI::BuildError
- Defined in:
- lib/lilac/cli/build/build_error.rb
Overview
Common base + formatter for build-time errors. Wraps a structured message into the multi-line shape:
lilac: build error in <file>:<line>
<snippet> # optional
<message body>
<suggestion> # optional
The bare-string form (raise BuildError, "...") is supported so
callers that don't have a location on hand can still raise, but
the formatted shape only kicks in when at: is provided.
Subclassed by Lilac::Directives::Lints::Error.
Direct Known Subclasses
Lilac::CLI::BytecodeBuilder::Error, PackageBuild::Error, PreviewServer::Error, TemplateAST::Error, Directives::Lints::Error
Instance Attribute Summary collapse
-
#at ⇒ Object
readonly
Returns the value of attribute at.
-
#snippet ⇒ Object
readonly
Returns the value of attribute snippet.
-
#suggestion ⇒ Object
readonly
Returns the value of attribute suggestion.
Instance Method Summary collapse
-
#initialize(message = nil, at: nil, snippet: nil, suggestion: nil) ⇒ BuildError
constructor
A new instance of BuildError.
Constructor Details
#initialize(message = nil, at: nil, snippet: nil, suggestion: nil) ⇒ BuildError
Returns a new instance of BuildError.
21 22 23 24 25 26 27 |
# File 'lib/lilac/cli/build/build_error.rb', line 21 def initialize( = nil, at: nil, snippet: nil, suggestion: nil) @at = at @snippet = snippet @suggestion = suggestion @body = super(format) end |
Instance Attribute Details
#at ⇒ Object (readonly)
Returns the value of attribute at.
19 20 21 |
# File 'lib/lilac/cli/build/build_error.rb', line 19 def at @at end |
#snippet ⇒ Object (readonly)
Returns the value of attribute snippet.
19 20 21 |
# File 'lib/lilac/cli/build/build_error.rb', line 19 def snippet @snippet end |
#suggestion ⇒ Object (readonly)
Returns the value of attribute suggestion.
19 20 21 |
# File 'lib/lilac/cli/build/build_error.rb', line 19 def suggestion @suggestion end |