fix: hook exception for empty hook (#6646)

This commit is contained in:
Tejaswini Chile 2023-03-10 16:40:15 +05:30 committed by GitHub
parent f2684545d9
commit c9b63ae8eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
class Integrations::BotProcessorService
# TODO: In CSML processor service, the argument is agent bot, update initializers accordingly.
pattr_initialize [:event_name!, :hook!, :event_data!]
def perform
@ -7,7 +8,7 @@ class Integrations::BotProcessorService
process_content(message)
rescue StandardError => e
ChatwootExceptionTracker.new(e, account: hook.account).capture_exception
ChatwootExceptionTracker.new(e, account: (hook&.account || agent_bot&.account)).capture_exception
end
private