Sha256: 92e60b84846db0c144de84e5a4ed0471358af2024f7bde04f727dba7cebbfa92

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module LedgerSync
  class Error
    class OperationError < Error
      attr_reader :operation, :response

      def initialize(operation:, message: nil, response: nil)
        message ||= 'Operation failed.'
        @operation = operation
        @response = response
        super(message: message)
      end

      class DuplicateLedgerResourceError < self; end
      class NotFoundError < self; end
      class LedgerValidationError < self; end
      class PerformedOperationError < self
        def initialize(operation:, message: nil, response: nil)
          message ||= 'Operation has already been performed. Please check the result.'

          super(
            message: message,
            operation: operation,
            response: response
          )
        end
      end

      class ValidationError < self
        attr_reader :attribute,
                    :validation

        def initialize(message:, attribute:, operation:, validation:, response: nil)
          @attribute = attribute
          @validation = validation

          super(
            message: message,
            operation: operation,
            response: response
          )
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ledger_sync-2.6.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.5.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.4.4 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.3.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.2.3 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.2.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.2.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.0.2 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.0.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.0.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-2.0.0.pre.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.8.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.8.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.7.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.6.0 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.5.2 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.5.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.5.0 lib/ledger_sync/error/operation_errors.rb