Handle missing files/URLs gracefully.
If no version of a URL is found the importer just skips the URL now instead of throwing an error.
This commit is contained in:
parent
10ebc63dc1
commit
f511dfbd56
1 changed files with 9 additions and 2 deletions
|
|
@ -39,7 +39,11 @@ module DebImporter
|
|||
def i18n(component, language)
|
||||
url = "#{@dist_url}/#{component}/i18n/Translation-en"
|
||||
file = find_and_open_compressed_url(url)
|
||||
return get_paragraphs(file)
|
||||
if file
|
||||
return get_paragraphs(file)
|
||||
else
|
||||
return []
|
||||
end
|
||||
end
|
||||
|
||||
# Look for the file or URL in various compressed formats
|
||||
|
|
@ -68,9 +72,12 @@ module DebImporter
|
|||
|
||||
return file
|
||||
rescue Errno::ENOENT
|
||||
Rails.logger.error "URL #{url} could not be opened. Skipping."
|
||||
Rails.logger.debug "URL #{url} could not be opened. Skipping."
|
||||
end
|
||||
end
|
||||
|
||||
Rails.logger.error "No file found at #{url} and various compression extensions."
|
||||
return nil
|
||||
end
|
||||
|
||||
# Try to load the Packages file for a certain component (e.g. "main")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue