Sha256: dd00a86686551ecf30dfd468c0d7a437e30ad7553846748d71b61289e31efdb7

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasJSendResultShortSyntax
        module Error
          module Exceptions
            class BothArgsAndKwargsArePassed < ::ConvenientService::Exception
              def initialize
                message = <<~TEXT
                  Both `args` and `kwargs` are passed to the `error` method.

                  Did you mean something like:

                  error("Helpful text")
                  error("Helpful text", :descriptive_code)

                  error(message: "Helpful text")
                  error(message: "Helpful text", code: :descriptive_code)
                TEXT

                super(message)
              end
            end

            class MoreThanTwoArgsArePassed < ::ConvenientService::Exception
              def initialize
                message = <<~TEXT
                  More than two `args` are passed to the `error` method.

                  Did you mean something like:

                  error("Helpful text")
                  error("Helpful text", :descriptive_code)
                TEXT

                super(message)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.13.0 lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb