Sha256: 8caa7f950abafaa8e54aa7c1dc386921cc9b2ea32a506fd7adad6846e89377ec

Contents?: true

Size: 680 Bytes

Versions: 6

Compression:

Stored size: 680 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 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

6 entries across 6 versions & 1 rubygems

Version Path
hamlit-0.3.3 lib/hamlit/concerns/error.rb
hamlit-0.3.2 lib/hamlit/concerns/error.rb
hamlit-0.3.1 lib/hamlit/concerns/error.rb
hamlit-0.3.0 lib/hamlit/concerns/error.rb
hamlit-0.2.0 lib/hamlit/concerns/error.rb
hamlit-0.1.3 lib/hamlit/concerns/error.rb