FIX: Continue if checking themes if updating one fails (#19665)

This commit is contained in:
Daniel Waterworth 2023-01-09 11:56:43 -06:00 committed by GitHub
parent baccf7e5c9
commit dfc449a32e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -11,9 +11,11 @@ module Jobs
.where.not(remote_url: "") .where.not(remote_url: "")
target_themes.each do |remote| target_themes.each do |remote|
Discourse.capture_exceptions(message: "Error updating theme #{remote.id}") do
remote.update_remote_version remote.update_remote_version
remote.save! remote.save!
end end
end end
end end
end end
end

View File

@ -932,6 +932,13 @@ module Discourse
STDERR.puts "Failed to report exception #{e} #{message}" STDERR.puts "Failed to report exception #{e} #{message}"
end end
def self.capture_exceptions(message: "", env: nil)
yield
rescue Exception => e
Discourse.warn_exception(e, message: message, env: env)
nil
end
def self.deprecate(warning, drop_from: nil, since: nil, raise_error: false, output_in_test: false) def self.deprecate(warning, drop_from: nil, since: nil, raise_error: false, output_in_test: false)
location = caller_locations[1].yield_self { |l| "#{l.path}:#{l.lineno}:in \`#{l.label}\`" } location = caller_locations[1].yield_self { |l| "#{l.path}:#{l.lineno}:in \`#{l.label}\`" }
warning = ["Deprecation notice:", warning] warning = ["Deprecation notice:", warning]