mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Move exception text into exception object
This commit is contained in:
parent
912a586d15
commit
8b51cf019d
@ -184,12 +184,7 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
|
|||||||
had_incomplete_download = false
|
had_incomplete_download = false
|
||||||
retry
|
retry
|
||||||
else
|
else
|
||||||
if @url =~ %r[^file://]
|
raise CurlDownloadStrategyError.new(@url)
|
||||||
msg = "File does not exist: #{@url.sub(%r[^file://], "")}"
|
|
||||||
else
|
|
||||||
msg = "Download failed: #{@url}"
|
|
||||||
end
|
|
||||||
raise CurlDownloadStrategyError, msg
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ignore_interrupts { temporary_path.rename(cached_location) }
|
ignore_interrupts { temporary_path.rename(cached_location) }
|
||||||
|
@ -208,7 +208,16 @@ class DownloadError < RuntimeError
|
|||||||
end
|
end
|
||||||
|
|
||||||
# raised in CurlDownloadStrategy.fetch
|
# 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
|
# raised by safe_system in utils.rb
|
||||||
class ErrorDuringExecution < RuntimeError
|
class ErrorDuringExecution < RuntimeError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user