Rescue all icon download/upload errors, send to Sentry
This commit is contained in:
parent
3f110995a4
commit
bd1b177993
@ -20,6 +20,8 @@ module AppCatalogManager
|
||||
|
||||
@app.save!
|
||||
|
||||
# TODO move icon downloads to separate, async job
|
||||
|
||||
if icon = metadata.select_icon(sizes: "256x256") ||
|
||||
icon = metadata.select_icon(sizes: "192x192")
|
||||
attach_remote_image(:icon, icon)
|
||||
@ -49,7 +51,12 @@ module AppCatalogManager
|
||||
tempfile = Down.download(download_url)
|
||||
@app.send(attachment_name).attach(key: key, io: tempfile, filename: filename)
|
||||
rescue Down::NotFound
|
||||
Rails.logger.warn "Icon download failed: NotFound error for #{download_url}"
|
||||
msg = "Download of \"#{attachment_name}\" failed: NotFound error for #{download_url}"
|
||||
Rails.logger.warn(msg)
|
||||
Sentry.capture_message(msg)
|
||||
rescue => e
|
||||
Rails.logger.warn "Saving attachment \"#{attachment_name}\" failed: \"#{e.message}\""
|
||||
Sentry.capture_exception(e) if Setting.sentry_enabled?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user