Sha256: d8dfa0a943c1307daa3d2f4eb3178f5035246a95f22d2ecb3877799a439cf9db

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

module Dry
  module Monads
    # An unsuccessful result of extracting a value from a monad.
    class UnwrapError < StandardError
      def initialize(ctx)
        super("value! was called on #{ ctx.inspect }")
      end
    end

    # An error thrown on returning a Failure of unknown type.
    class InvalidFailureTypeError < StandardError
      def initialize(failure)
        super("Cannot create Failure from #{ failure.inspect }, it doesn't meet the constraints")
      end
    end

    # Improper use of None
    class ConstructorNotAppliedError < NoMethodError
      def initialize(method_name, constructor_name)
        super(
          "For calling .#{method_name} on #{constructor_name}() build a value "\
          "by appending parens: #{constructor_name}()"
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-monads-1.3.4 lib/dry/monads/errors.rb
dry-monads-1.3.3 lib/dry/monads/errors.rb
dry-monads-1.3.2 lib/dry/monads/errors.rb
dry-monads-1.3.1 lib/dry/monads/errors.rb
dry-monads-1.3.0 lib/dry/monads/errors.rb