Sha256: fddae190409b88ad6a60c2f872e58becfb40f44feee64342714ee0dd8ea243fe

Contents?: true

Size: 955 Bytes

Versions: 3

Compression:

Stored size: 955 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_error'

module Reek
  module Errors
    # Gets raised when Reek is unable to process the source due to a SyntaxError
    class SyntaxError < BaseError
      TEMPLATE = "Source '%<source>s' cannot be processed by Reek due to a syntax error in the source file."

      LONG_TEMPLATE = <<-MESSAGE
        !!!
        %<message>s

        This is a problem that is outside of Reek's scope and should be fixed by you, the
        user, in order for Reek being able to continue.

        Exception message:

        %<exception>s

        Original backtrace:

        %<original>s

        !!!
      MESSAGE

      def initialize(origin:)
        super format(TEMPLATE, source: origin)
      end

      def long_message
        format(LONG_TEMPLATE,
               message: message,
               exception: cause.inspect,
               original: cause.backtrace.join("\n\t"))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-5.0.2 lib/reek/errors/syntax_error.rb
reek-5.0.1 lib/reek/errors/syntax_error.rb
reek-5.0.0 lib/reek/errors/syntax_error.rb