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
|
||||
|
||||
class BadgeGranter
|
||||
class GrantError < StandardError; end
|
||||
|
||||
def self.disable_queue
|
||||
@queue_disabled = true
|
||||
|
@ -390,8 +391,7 @@ class BadgeGranter
|
|||
|
||||
badge.reset_grant_count!
|
||||
rescue => e
|
||||
Rails.logger.error("Failed to backfill '#{badge.name}' badge: #{opts}")
|
||||
raise e
|
||||
raise GrantError, "Failed to backfill '#{badge.name}' badge: #{opts}. Reason: #{e.message}"
|
||||
end
|
||||
|
||||
def self.revoke_ungranted_titles!
|
||||
|
|
Loading…
Reference in New Issue