Sha256: 434915a59886eef5cf7150f7dead9e3e5bebf7f1efdc0af35ecdc6fcac662cdd

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 KB

Contents

module Regrit
  # Error base class
  class Error < RuntimeError
  end

  # Raised when the URI received is not a valid or able to be parsed.
  class InvalidURIError < Error
    def initialize
      super "Invalid repository URI"
    end
  end

  # Raised when a repository is not accessible in some form.
  class Inaccessible < Error
    def initialize(message)
      super "Repository Inaccessible: #{message}"
    end
  end

  # Raised when a secure repository is accessed without a key
  class PrivateKeyRequired < Inaccessible
    def initialize(uri)
      super "SSH private key required for secure git repository: #{uri}"
    end
  end

  # Raised when accessing a repository times out
  class TimeoutError < Inaccessible
    def initialize(command, uri)
      super "Timeout when attempting to access git repository: #{uri} with command: #{command.inspect}"
    end
  end

  # Raised when there is an error calling git ls-remote (i.e. inaccessible repo)
  class CommandError < Inaccessible
    def initialize(command, status, stdout, stderr)
      super <<-ERROR
Command `#{command}` exited with a non-zero exit status [#{status}]:
stdout:
#{stdout}

stderr:
#{stderr}
      ERROR
    end
  end

  # Raised when the Refs format is unrecognized
  class InvalidRefsFormat < Inaccessible
    def initialize(raw_refs)
      super <<-ERROR
Invalid git refs format:
#{raw_refs}
      ERROR
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
regrit-0.2.1 lib/regrit/errors.rb
regrit-0.2.0 lib/regrit/errors.rb
regrit-0.1.0 lib/regrit/errors.rb
regrit-0.0.6 lib/regrit/errors.rb
regrit-0.0.5 lib/regrit/errors.rb