Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 80dcb2f

Browse files
author
Bash06
committed
fix: invalid usage of sentry
1 parent b512164 commit 80dcb2f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

api/share.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ func (h *Handler) FollowShare(c *gin.Context) {
9595
videoUrl, err = utils.ScrapeFromHTML(postId)
9696
if err != nil || videoUrl == "" {
9797
slog.Error("Failed to scrape video URL from HTML. Trying to make an API request...", slog.Any("err", err))
98-
sentry.CaptureException(err)
98+
99+
if err != nil {
100+
sentry.CaptureException(err)
101+
}
99102

100103
// 2: Try to get the post data from an API request
101104
data, err := utils.FetchPost(postId)
@@ -158,6 +161,7 @@ func (h *Handler) FollowShare(c *gin.Context) {
158161
CdnURL: videoUrl,
159162
}).Error
160163
if err != nil {
164+
sentry.CaptureException(err)
161165
slog.Error("Failed to save cdn url to memory database", slog.Any("err", err))
162166
}
163167
}

api/video.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ func (h *Handler) ServeVideo(c *gin.Context) {
8181
videoUrl, err = utils.ScrapeFromHTML(postId)
8282
if err != nil || videoUrl == "" {
8383
slog.Error("Failed to scrape video URL from HTML. Trying to make an API request...", slog.Any("err", err))
84-
sentry.CaptureException(err)
84+
85+
if err != nil {
86+
sentry.CaptureException(err)
87+
}
8588

8689
// 2: Try to get the post data from an API request
8790
data, err := utils.FetchPost(postId)
@@ -145,6 +148,7 @@ func (h *Handler) ServeVideo(c *gin.Context) {
145148
CdnURL: videoUrl,
146149
}).Error
147150
if err != nil {
151+
sentry.CaptureException(err)
148152
slog.Error("Failed to save cdn url to memory database", slog.Any("err", err))
149153
}
150154
}

0 commit comments

Comments
 (0)