mirror of
https://github.com/discourse/discourse.git
synced 2025-03-28 21:33:03 +08:00
DEV: raises a GrantError instead of a log and a variable exception (#12875)
The message in logs will now look like: ``` BadgeGranter::GrantError: Failed to backfill 'Some Badge' badge: {:post_ids=>[]}. Reason: ERROR: column "email" does not exist LINE 6: ...t id as user_id, current_timestamp as granted_at, email from... ```
This commit is contained in:
parent
7568c7a101
commit
54472e4150
@ -1,6 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class BadgeGranter
|
class BadgeGranter
|
||||||
|
class GrantError < StandardError; end
|
||||||
|
|
||||||
def self.disable_queue
|
def self.disable_queue
|
||||||
@queue_disabled = true
|
@queue_disabled = true
|
||||||
@ -390,8 +391,7 @@ class BadgeGranter
|
|||||||
|
|
||||||
badge.reset_grant_count!
|
badge.reset_grant_count!
|
||||||
rescue => e
|
rescue => e
|
||||||
Rails.logger.error("Failed to backfill '#{badge.name}' badge: #{opts}")
|
raise GrantError, "Failed to backfill '#{badge.name}' badge: #{opts}. Reason: #{e.message}"
|
||||||
raise e
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.revoke_ungranted_titles!
|
def self.revoke_ungranted_titles!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user