/usr/lib/ruby/vendor_ruby/haml/error.rb is in ruby-haml 4.0.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | module Haml
# An exception raised by Haml code.
class Error < StandardError
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
}
def self.message(key, *args)
string = MESSAGES[key] or raise "[HAML BUG] No error messages for #{key}"
(args.empty? ? string : string % args).rstrip
end
# The line of the template on which the error occurred.
#
# @return [Fixnum]
attr_reader :line
# @param message [String] The error message
# @param line [Fixnum] See \{#line}
def initialize(message = nil, line = nil)
super(message)
@line = line
end
end
# SyntaxError is the type of exception raised when Haml encounters an
# ill-formatted document.
# It's not particularly interesting,
# except in that it's a subclass of {Haml::Error}.
class SyntaxError < Error; end
end
|