Sha256: dee0381bf65d79b1497735d066ccff24ea618284ef0853e3bd559fd37fcac295

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

module Solve
  module Errors
    class SolveError < StandardError
      alias_method :mesage, :to_s
    end

    class InvalidVersionFormat < SolveError
      attr_reader :version

      # @param [#to_s] version
      def initialize(version)
        @version = version
      end

      def to_s
        "'#{version}' did not contain a valid version string: 'x.y.z' or 'x.y'."
      end
    end

    class InvalidConstraintFormat < SolveError
      attr_reader :constraint

      # @param [#to_s] constraint
      def initialize(constraint)
        @constraint = constraint
      end

      def to_s
        "'#{constraint}' did not contain a valid operator or a valid version string."
      end
    end

    class NoSolutionError < SolveError; end

    class UnsortableSolutionError < SolveError
      attr_reader :internal_exception
      attr_reader :unsorted_solution

      def initialize(internal_exception, unsorted_solution)
        @internal_exception = internal_exception
        @unsorted_solution  = unsorted_solution
      end

      def to_s
        "The solution contains a cycle and cannot be topologically sorted. See #unsorted_solution on this exception for the unsorted solution"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solve-0.8.2 lib/solve/errors.rb
solve-0.8.1 lib/solve/errors.rb
solve-0.8.0 lib/solve/errors.rb
solve-0.7.0 lib/solve/errors.rb