Sha256: 2f63e5a9c83d9e619054f1956c0831b69689d4394b835ec62245d225ee4a3368

Contents?: true

Size: 1011 Bytes

Versions: 6

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  class Error
    class OperationError < Error
      attr_reader :operation

      def initialize(message:, operation:)
        @operation = operation
        super(message: message)
      end

      class DuplicateLedgerResourceError < self; end
      class NotFoundError < self; end
      class LedgerValidationError < self; end

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

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

      class ValidationError < self
        attr_reader :attribute,
                    :validation

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ledger_sync-1.1.1 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.0.10 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.0.9 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.0.3 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.0.2 lib/ledger_sync/error/operation_errors.rb
ledger_sync-1.0.0 lib/ledger_sync/error/operation_errors.rb