Sha256: bef608444ef7e3a837b5e6516678dd56762a0ece8e08c5a3356809548cdefafc

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

module ThorSCMVersion
  # @author Josiah Kiehl <josiah@skirmisher.net>
  # adapted from code written by Jamie Winsor <jamie@vialstudios.com>
  class SCMVersionError < StandardError
    class << self
      # @param [Integer] code
      def status_code(code)
        define_method(:status_code) { code }
        define_singleton_method(:status_code) { code }
      end
    end

    alias_method :message, :to_s
  end

  class InternalError < SCMVersionError; status_code(99); end

  class TagFormatError < SCMVersionError
    status_code(100)
    def initialize(tag); @tag = tag; end
    def to_s; "#{@tag.inspect} is formatted incorrectly."; end
  end
  class InvalidPrereleaseFormatError < TagFormatError
    def to_s; super + " Format must be: #{Prerelease::FORMAT.inspect}."; end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thor-scmversion-1.2.1 lib/thor-scmversion/errors.rb
thor-scmversion-1.1.0 lib/thor-scmversion/errors.rb
thor-scmversion-1.0.1 lib/thor-scmversion/errors.rb
thor-scmversion-1.0.0 lib/thor-scmversion/errors.rb