Exception: Haml::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Haml::Error
- Defined in:
- lib/haml/error.rb
Direct Known Subclasses
Constant Summary collapse
- MESSAGES =
{ bad_script_indent: '"%s" is indented at wrong level: expected %d, but was at %d.', cant_run_filter: 'Can\'t run "%s" filter; you must require its dependencies first', cant_use_tabs_and_spaces: "Indentation can't use both tabs and spaces.", deeper_indenting: "The line was indented %d levels deeper than the previous line.", filter_not_defined: 'Filter "%s" is not defined.', gem_install_filter_deps: '"%s" filter\'s %s dependency missing: try installing it or adding it to your Gemfile', illegal_element: "Illegal element: classes and ids must have values.", illegal_nesting_content: "Illegal nesting: nesting within a tag that already has content is illegal.", illegal_nesting_header: "Illegal nesting: nesting within a header command is illegal.", illegal_nesting_line: "Illegal nesting: content can't be both given on the same line as %%%s and nested within it.", illegal_nesting_plain: "Illegal nesting: nesting within plain text is illegal.", illegal_nesting_self_closing: "Illegal nesting: nesting within a self-closing tag is illegal.", inconsistent_indentation: "Inconsistent indentation: %s used for indentation, but the rest of the document was indented using %s.", indenting_at_start: "Indenting at the beginning of the document is illegal.", install_haml_contrib: 'To use the "%s" filter, please install the haml-contrib gem.', invalid_attribute_list: 'Invalid attribute list: %s.', invalid_filter_name: 'Invalid filter name ":%s".', invalid_tag: 'Invalid tag: "%s".', missing_if: 'Got "%s" with no preceding "if"', no_ruby_code: "There's no Ruby code for %s to evaluate.", self_closing_content: "Self-closing tags can't have content.", unbalanced_brackets: 'Unbalanced brackets.', no_end: <<-END You don't need to use "- end" in Haml. Un-indent to close a block: - if foo? %strong Foo! - else Not foo. %p This line is un-indented, so it isn't part of the "if" block END }.freeze
Instance Attribute Summary collapse
-
#line ⇒ Fixnum
readonly
The line of the template on which the error occurred.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, line = nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message = nil, line = nil) ⇒ Error
Returns a new instance of Error.
49 50 51 52 |
# File 'lib/haml/error.rb', line 49
def initialize(message = nil, line = nil)
super(message)
@line = line
end
|
Instance Attribute Details
#line ⇒ Fixnum (readonly)
The line of the template on which the error occurred.
45 46 47 |
# File 'lib/haml/error.rb', line 45
def line
@line
end
|
Class Method Details
.message(key, *args)
37 38 39 40 |
# File 'lib/haml/error.rb', line 37
def self.message(key, *args)
string = MESSAGES[key] or raise "[HAML BUG] No error messages for #{key}"
(args.empty? ? string : string % args).rstrip
end
|