From 596dbc6ecaff73d0ec07220ff51745880cd77b4e Mon Sep 17 00:00:00 2001 From: Stefan Kostic Date: Fri, 18 Feb 2022 12:46:35 +0100 Subject: [PATCH] Use sentry capture for handle payment errors --- lib/service/invoices.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/service/invoices.go b/lib/service/invoices.go index a169221..9b43d93 100644 --- a/lib/service/invoices.go +++ b/lib/service/invoices.go @@ -9,6 +9,7 @@ import ( "github.com/getAlby/lndhub.go/common" "github.com/getAlby/lndhub.go/db/models" + "github.com/getsentry/sentry-go" "github.com/labstack/gommon/random" "github.com/lightningnetwork/lnd/lnrpc" "github.com/uptrace/bun" @@ -204,6 +205,7 @@ func (svc *LndhubService) HandleFailedPayment(ctx context.Context, invoice *mode } _, err := svc.DB.NewInsert().Model(&entry).Exec(ctx) if err != nil { + sentry.CaptureException(err) svc.Logger.Errorf("Could not insert transaction entry user_id:%v invoice_id:%v", invoice.UserID, invoice.ID) return err } @@ -215,6 +217,7 @@ func (svc *LndhubService) HandleFailedPayment(ctx context.Context, invoice *mode _, err = svc.DB.NewUpdate().Model(invoice).WherePK().Exec(ctx) if err != nil { + sentry.CaptureException(err) svc.Logger.Errorf("Could not update failed payment invoice user_id:%v invoice_id:%v", invoice.UserID, invoice.ID) } return err @@ -226,6 +229,7 @@ func (svc *LndhubService) HandleSuccessfulPayment(ctx context.Context, invoice * _, err := svc.DB.NewUpdate().Model(invoice).WherePK().Exec(ctx) if err != nil { + sentry.CaptureException(err) svc.Logger.Errorf("Could not update sucessful payment invoice user_id:%v invoice_id:%v", invoice.UserID, invoice.ID) } return err