Exception: R10K::Git::NonexistentHashError
- Inherits:
-
StandardError
- Object
- StandardError
- R10K::Git::NonexistentHashError
- Defined in:
- lib/r10k/git/errors.rb
Constant Summary collapse
- HASHLIKE =
%r[[A-Fa-f0-9]]
Instance Attribute Summary collapse
-
#git_dir ⇒ Object
readonly
Returns the value of attribute git_dir.
-
#hash ⇒ Object
readonly
Raised when a hash was requested that can’t be found in the repository.
Instance Method Summary collapse
-
#initialize(msg = nil, git_dir = nil) ⇒ NonexistentHashError
constructor
A new instance of NonexistentHashError.
-
#message ⇒ Object
Print a friendly error message if an object hash is given as the message.
Constructor Details
#initialize(msg = nil, git_dir = nil) ⇒ NonexistentHashError
Returns a new instance of NonexistentHashError.
9 10 11 12 13 |
# File 'lib/r10k/git/errors.rb', line 9 def initialize(msg = nil, git_dir = nil) super(msg) @git_dir = git_dir end |
Instance Attribute Details
#git_dir ⇒ Object (readonly)
Returns the value of attribute git_dir.
7 8 9 |
# File 'lib/r10k/git/errors.rb', line 7 def git_dir @git_dir end |
#hash ⇒ Object (readonly)
Raised when a hash was requested that can’t be found in the repository
6 7 8 |
# File 'lib/r10k/git/errors.rb', line 6 def hash @hash end |
Instance Method Details
#message ⇒ Object
Print a friendly error message if an object hash is given as the message
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/r10k/git/errors.rb', line 18 def msg = super if msg and msg.match(HASHLIKE) msg = "Could not locate hash #{msg.inspect} in repository" elsif msg.nil? msg = "Could not locate hash in repository" end if @git_dir msg << " at #{@git_dir}. (Does the remote repository need to be updated?)" end msg end |