Sha256: 3ce34bf0785914f28eb7a15de560e51f92790c60d520e5bdb0e7b18138a01a68

Contents?: true

Size: 901 Bytes

Versions: 1

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasJSendResultShortSyntax
        module Failure
          module Exceptions
            class KwargsContainNonJSendKey < ::ConvenientService::Exception
              def initialize(key:)
                message = <<~TEXT
                  When `kwargs` with `data` key are passed to `failure` method, they can NOT contain non JSend keys like `#{key.inspect}`.

                  Please, consider something like:

                  failure(foo: :bar) # short version does NOT support custom message
                  failure(data: {foo: :bar}) # long version
                  failure(data: {foo: :bar}, message: "foo") # long version with custom message
                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/failure/exceptions.rb