Sha256: 5718a75f25c60b8f833cd1b558f6b4af35ec67b3b7ed0d9014bc605457418cc4

Contents?: true

Size: 1.26 KB

Versions: 25

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
module Dynflow
  module Errors
    class RescueError < StandardError; end

    # placeholder in case the deserialized error is no longer available
    class UnknownError < StandardError
      def self.for_exception_class(class_name)
        Class.new(self) do
          define_singleton_method :name do
            class_name
          end
        end
      end

      def self.inspect
        "#{UnknownError.name}[#{name}]"
      end

      def self.to_s
        inspect
      end

      def inspect
        "#{self.class.inspect}: #{message}"
      end
    end

    class InactiveWorldError < Dynflow::Error
      def initialize(world)
        super("The world #{world.id} is not active (terminating or terminated)")
      end
    end

    class DataConsistencyError < Dynflow::Error
    end

    # any persistence errors
    class PersistenceError < Dynflow::Error
      def self.delegate(original_exception)
        self.new("caused by #{original_exception.class}: #{original_exception.message}").tap do |e|
          e.set_backtrace original_exception.backtrace
        end
      end
    end

    # persistence errors that can't be recovered from, such as continuous connection issues
    class FatalPersistenceError < PersistenceError
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dynflow-1.4.4 lib/dynflow/errors.rb
dynflow-1.4.3 lib/dynflow/errors.rb
dynflow-1.4.2 lib/dynflow/errors.rb
dynflow-1.4.1 lib/dynflow/errors.rb
dynflow-1.4.0 lib/dynflow/errors.rb