From 5e191b0a652e23f25e69769c9bc3f8c969d76692 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 29 Dec 2014 22:52:53 -0500 Subject: Move exception text into exception object --- Library/Homebrew/exceptions.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/exceptions.rb') diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index a6a3380bb..66d5c33d2 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -208,7 +208,16 @@ class DownloadError < RuntimeError end # raised in CurlDownloadStrategy.fetch -class CurlDownloadStrategyError < RuntimeError; end +class CurlDownloadStrategyError < RuntimeError + def initialize(url) + case url + when %r[^file://(.+)] + super "File does not exist: #{$1}" + else + super "Download failed: #{url}" + end + end +end # raised by safe_system in utils.rb class ErrorDuringExecution < RuntimeError -- cgit v1.2.3