mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-21 14:19:39 +02:00
Capture webhook errors in Sentry
This commit is contained in:
parent
972c850d27
commit
331de2f997
1 changed files with 5 additions and 2 deletions
|
@ -11,6 +11,7 @@ class WebhooksController < ApplicationController
|
||||||
|
|
||||||
render json: { received: true }, status: :ok
|
render json: { received: true }, status: :ok
|
||||||
rescue => error
|
rescue => error
|
||||||
|
Sentry.capture_exception(error)
|
||||||
render json: { error: "Invalid webhook: #{error.message}" }, status: :bad_request
|
render json: { error: "Invalid webhook: #{error.message}" }, status: :bad_request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,10 +34,12 @@ class WebhooksController < ApplicationController
|
||||||
Rails.logger.info "Unhandled event type: #{event.type}"
|
Rails.logger.info "Unhandled event type: #{event.type}"
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue JSON::ParserError
|
rescue JSON::ParserError => error
|
||||||
|
Sentry.capture_exception(error)
|
||||||
render json: { error: "Invalid payload" }, status: :bad_request
|
render json: { error: "Invalid payload" }, status: :bad_request
|
||||||
return
|
return
|
||||||
rescue Stripe::SignatureVerificationError
|
rescue Stripe::SignatureVerificationError => error
|
||||||
|
Sentry.capture_exception(error)
|
||||||
render json: { error: "Invalid signature" }, status: :bad_request
|
render json: { error: "Invalid signature" }, status: :bad_request
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue