File: errors.rb

package info (click to toggle)
ruby-semverse 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: ruby: 1,146; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Semverse
  class SemverseError < StandardError; end

  class InvalidVersionFormat < SemverseError
    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 < SemverseError
    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 < SemverseError; end
end