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)
|
def i18n(component, language)
|
||||||
url = "#{@dist_url}/#{component}/i18n/Translation-en"
|
url = "#{@dist_url}/#{component}/i18n/Translation-en"
|
||||||
file = find_and_open_compressed_url(url)
|
file = find_and_open_compressed_url(url)
|
||||||
return get_paragraphs(file)
|
if file
|
||||||
|
return get_paragraphs(file)
|
||||||
|
else
|
||||||
|
return []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Look for the file or URL in various compressed formats
|
# Look for the file or URL in various compressed formats
|
||||||
|
|
@ -68,9 +72,12 @@ module DebImporter
|
||||||
|
|
||||||
return file
|
return file
|
||||||
rescue Errno::ENOENT
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Rails.logger.error "No file found at #{url} and various compression extensions."
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Try to load the Packages file for a certain component (e.g. "main")
|
# Try to load the Packages file for a certain component (e.g. "main")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue