fix: Handle OpenAI API errors (#9560)

This commit is contained in:
Muhsin Keloth
2024-08-22 10:24:13 +05:30
committed by GitHub
parent 6571baf211
commit 429d281501
8 changed files with 30 additions and 18 deletions

View File

@@ -11,7 +11,12 @@ class Api::V1::Accounts::Integrations::HooksController < Api::V1::Accounts::Base
end
def process_event
render json: { message: @hook.process_event(params[:event]) }
response = @hook.process_event(params[:event])
if response[:error]
render json: { error: response[:error] }, status: :unprocessable_entity
else
render json: { message: response[:message] }
end
end
def destroy