Sha256: 8750d1d84d2052dfaee87f463e4b23a7ce9510837d40507aee884f40ef0d511a

Contents?: true

Size: 771 Bytes

Versions: 46

Compression:

Stored size: 771 Bytes

Contents

module Hamlit
  class SyntaxError < StandardError; end
  class CompileError < StandardError; end

  module Concerns
    module Error
      # Template engine should raise Exception on runtime to
      # show template's error backtrace.
      def syntax_error(message)
        code = %Q{raise Hamlit::SyntaxError.new(%q{#{message}})}
        [:code, code]
      end

      def syntax_error!(message)
        raise Hamlit::SyntaxError.new(message)
      end

      def copmile_error!(message)
        raise CompileError.new(message)
      end

      def assert_scan!(scanner, regexp)
        result = scanner.scan(regexp)
        unless result
          raise CompileError.new("Expected to scan #{regexp} but got nil")
        end
        result
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hamlit-1.7.2 lib/hamlit/concerns/error.rb
hamlit-1.7.1 lib/hamlit/concerns/error.rb
hamlit-1.7.0 lib/hamlit/concerns/error.rb
hamlit-1.6.7 lib/hamlit/concerns/error.rb
hamlit-1.6.6 lib/hamlit/concerns/error.rb
hamlit-1.6.5 lib/hamlit/concerns/error.rb
hamlit-1.6.4 lib/hamlit/concerns/error.rb
hamlit-1.6.3 lib/hamlit/concerns/error.rb
hamlit-1.6.2 lib/hamlit/concerns/error.rb
hamlit-1.6.1 lib/hamlit/concerns/error.rb
hamlit-1.6.0 lib/hamlit/concerns/error.rb
hamlit-1.5.9 lib/hamlit/concerns/error.rb
hamlit-1.5.8 lib/hamlit/concerns/error.rb
hamlit-1.5.7 lib/hamlit/concerns/error.rb
hamlit-1.5.6 lib/hamlit/concerns/error.rb
hamlit-1.5.5 lib/hamlit/concerns/error.rb
hamlit-1.5.4 lib/hamlit/concerns/error.rb
hamlit-1.5.3 lib/hamlit/concerns/error.rb
hamlit-1.5.2 lib/hamlit/concerns/error.rb
hamlit-1.5.1 lib/hamlit/concerns/error.rb