diff options
| author | Jack Nagel | 2012-06-18 19:58:35 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-07-04 22:47:33 -0500 |
| commit | 76b2eee7771ecf2b339d1023699ef9f30fa3fe65 (patch) | |
| tree | df5ab7ba72806e408a6e9617bb3eaa195889be0a /Library/Homebrew/exceptions.rb | |
| parent | 2c6e93cf8aa77c5cfa6f16cafa7bf372d3afc7ab (diff) | |
| download | brew-76b2eee7771ecf2b339d1023699ef9f30fa3fe65.tar.bz2 | |
Refactor checksumming
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index d3e2e8936..2b7f6542c 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -148,3 +148,29 @@ end # raised by safe_system in utils.rb class ErrorDuringExecution < RuntimeError end + +# raised by Pathname#verify_checksum when cksum is nil or empty +class ChecksumMissingError < ArgumentError +end + +# raised by Pathname#verify_checksum when verification fails +class ChecksumMismatchError < RuntimeError + attr :advice, true + attr :expected + attr :actual + + def initialize expected, actual + @expected = expected + @actual = actual + + super <<-EOS.undent + #{expected.hash_type.to_s.upcase} mismatch + Expected: #{expected} + Actual: #{actual} + EOS + end + + def to_s + super + advice + end +end |
