Sha256: a8704c59e2854a55db30785d8d620d6cc4124447c974c9389642e2ae5f5466c5

Contents?: true

Size: 1.09 KB

Versions: 28

Compression:

Stored size: 1.09 KB

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 an EncodingError
    class EncodingError < BaseError
      TEMPLATE = "Source '%<source>s' cannot be processed by Reek due to an encoding 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.
        Check out this article for an idea on how to get started:
        https://www.justinweiss.com/articles/3-steps-to-fix-encoding-problems-in-ruby/

        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

28 entries across 26 versions & 2 rubygems

Version Path
reek-6.1.4 lib/reek/errors/encoding_error.rb
reek-6.1.3 lib/reek/errors/encoding_error.rb
reek-6.1.2 lib/reek/errors/encoding_error.rb
reek-6.1.1 lib/reek/errors/encoding_error.rb
reek-6.1.0 lib/reek/errors/encoding_error.rb
reek-6.0.6 lib/reek/errors/encoding_error.rb
reek-6.0.5 lib/reek/errors/encoding_error.rb
reek-6.0.4 lib/reek/errors/encoding_error.rb
reek-6.0.3 lib/reek/errors/encoding_error.rb
reek-6.0.2 lib/reek/errors/encoding_error.rb
reek-6.0.1 lib/reek/errors/encoding_error.rb
reek-6.0.0 lib/reek/errors/encoding_error.rb
reek-5.6.0 lib/reek/errors/encoding_error.rb
reek-5.5.0 lib/reek/errors/encoding_error.rb
reek-5.4.1 lib/reek/errors/encoding_error.rb
reek-5.4.0 lib/reek/errors/encoding_error.rb
reek-5.3.2 lib/reek/errors/encoding_error.rb
reek-5.3.1 lib/reek/errors/encoding_error.rb
reek-5.3.0 lib/reek/errors/encoding_error.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/errors/encoding_error.rb