Skip to content

Commit 47a4fb9

Browse files
AchoArnoldCopilot
andcommitted
fix(api): resolve Go vet errors
Make printf-like error wrapping explicit for Go 1.26, use keyed BSON elements, and keep live-server handler tests out of the unit suite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5e77d279-9f4a-46bc-97b1-db6975c76faf
1 parent a6ac393 commit 47a4fb9

86 files changed

Lines changed: 820 additions & 815 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/pkg/cache/memory_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (cache *memoryCache) Get(ctx context.Context, key string) (value string, er
3131

3232
response, ok := cache.store.Get(key)
3333
if !ok {
34-
return "", stacktrace.NewError(fmt.Sprintf("no item found in cache with key [%s]", key))
34+
return "", stacktrace.NewError("%s", fmt.Sprintf("no item found in cache with key [%s]", key))
3535
}
3636

3737
return response.(string), nil

api/pkg/cache/redis_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ func (cache *redisCache) Get(ctx context.Context, key string) (value string, err
3232

3333
response, err := cache.client.Get(ctx, key).Result()
3434
if errors.Is(err, redis.Nil) {
35-
return "", stacktrace.Propagate(err, fmt.Sprintf("no item found in redis with key [%s]", key))
35+
return "", stacktrace.Propagate(err, "%s", fmt.Sprintf("no item found in redis with key [%s]", key))
3636
}
3737
if err != nil {
38-
return "", stacktrace.Propagate(err, fmt.Sprintf("cannot get item in redis with key [%s]", key))
38+
return "", stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot get item in redis with key [%s]", key))
3939
}
4040
return response, nil
4141
}

api/pkg/di/container.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ func (container *Container) DedicatedDB() (db *gorm.DB) {
279279

280280
container.logger.Debug(fmt.Sprintf("Running migrations for dedicated [%T]", db))
281281
if err = db.AutoMigrate(&entities.Heartbeat{}); err != nil {
282-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Heartbeat{})))
282+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Heartbeat{})))
283283
}
284284

285285
if err = db.AutoMigrate(&entities.HeartbeatMonitor{}); err != nil {
286-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.HeartbeatMonitor{})))
286+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.HeartbeatMonitor{})))
287287
}
288288

289289
return container.dedicatedDB
@@ -371,47 +371,47 @@ ALTER TABLE discords ADD CONSTRAINT IF NOT EXISTS uni_discords_server_id CHECK (
371371
}
372372

373373
if err = db.AutoMigrate(&entities.Message{}); err != nil {
374-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Message{})))
374+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Message{})))
375375
}
376376

377377
if err = db.AutoMigrate(&entities.MessageThread{}); err != nil {
378-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.MessageThread{})))
378+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.MessageThread{})))
379379
}
380380

381381
if err = db.AutoMigrate(&entities.User{}); err != nil {
382-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.User{})))
382+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.User{})))
383383
}
384384

385385
if err = db.AutoMigrate(&entities.MessageSendSchedule{}); err != nil {
386-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.MessageSendSchedule{})))
386+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.MessageSendSchedule{})))
387387
}
388388

389389
if err = db.AutoMigrate(&entities.Phone{}); err != nil {
390-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Phone{})))
390+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Phone{})))
391391
}
392392

393393
if err = db.AutoMigrate(&entities.PhoneNotification{}); err != nil {
394-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.PhoneNotification{})))
394+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.PhoneNotification{})))
395395
}
396396

397397
if err = db.AutoMigrate(&entities.BillingUsage{}); err != nil {
398-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.BillingUsage{})))
398+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.BillingUsage{})))
399399
}
400400

401401
if err = db.AutoMigrate(&entities.Webhook{}); err != nil {
402-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Webhook{})))
402+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Webhook{})))
403403
}
404404

405405
if err = db.AutoMigrate(&entities.Discord{}); err != nil {
406-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Discord{})))
406+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Discord{})))
407407
}
408408

409409
if err = db.AutoMigrate(&entities.Integration3CX{}); err != nil {
410-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.Integration3CX{})))
410+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.Integration3CX{})))
411411
}
412412

413413
if err = db.AutoMigrate(&entities.PhoneAPIKey{}); err != nil {
414-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot migrate %T", &entities.PhoneAPIKey{})))
414+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot migrate %T", &entities.PhoneAPIKey{})))
415415
}
416416

417417
return container.db
@@ -424,7 +424,7 @@ func (container *Container) FirebaseApp() (app *firebase.App) {
424424
app, err := firebase.NewApp(context.Background(), nil, option.WithCredentialsJSON(container.FirebaseCredentials()))
425425
if err != nil {
426426
msg := "cannot initialize firebase application"
427-
container.logger.Fatal(stacktrace.Propagate(err, msg))
427+
container.logger.Fatal(stacktrace.Propagate(err, "%s", msg))
428428
}
429429
return app
430430
}
@@ -445,7 +445,7 @@ func (container *Container) Cache() cache.Cache {
445445
container.logger.Debug("creating cache.Cache")
446446
opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
447447
if err != nil {
448-
container.logger.Fatal(stacktrace.Propagate(err, fmt.Sprintf("cannot parse redis url [%s]", os.Getenv("REDIS_URL"))))
448+
container.logger.Fatal(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot parse redis url [%s]", os.Getenv("REDIS_URL"))))
449449
}
450450
if strings.HasPrefix(os.Getenv("REDIS_URL"), "rediss://") {
451451
opt.TLSConfig = &tls.Config{
@@ -474,7 +474,7 @@ func (container *Container) FirebaseAuthClient() (client *auth.Client) {
474474
authClient, err := container.FirebaseApp().Auth(context.Background())
475475
if err != nil {
476476
msg := "cannot initialize firebase auth client"
477-
container.logger.Fatal(stacktrace.Propagate(err, msg))
477+
container.logger.Fatal(stacktrace.Propagate(err, "%s", msg))
478478
}
479479
return authClient
480480
}
@@ -554,7 +554,7 @@ func (container *Container) FCMClient() services.FCMClient {
554554
messagingClient, err := container.FirebaseApp().Messaging(context.Background())
555555
if err != nil {
556556
msg := "cannot initialize firebase messaging client"
557-
container.logger.Fatal(stacktrace.Propagate(err, msg))
557+
container.logger.Fatal(stacktrace.Propagate(err, "%s", msg))
558558
}
559559
return services.NewFirebaseFCMClient(messagingClient)
560560
}

api/pkg/handlers/attachment_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (h *AttachmentHandler) GetAttachment(c fiber.Ctx) error {
6767
data, err := h.storage.Download(ctx, path)
6868
if err != nil {
6969
msg := fmt.Sprintf("cannot download attachment from path [%s]", path)
70-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
70+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
7171
if stacktrace.GetCode(err) == repositories.ErrCodeNotFound {
7272
return h.responseNotFound(c, "attachment not found")
7373
}

api/pkg/handlers/billing_handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ func (h *BillingHandler) UsageHistory(c fiber.Ctx) error {
6666
var request requests.BillingUsageHistory
6767
if err := c.Bind().Query(&request); err != nil {
6868
msg := fmt.Sprintf("cannot marshall params [%s] into %T", c.Body(), request)
69-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
69+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
7070
return h.responseBadRequest(c, err)
7171
}
7272

7373
if errors := h.validator.ValidateHistory(ctx, request.Sanitize()); len(errors) != 0 {
7474
msg := fmt.Sprintf("validation errors [%s], while fetching heartbeats [%+#v]", spew.Sdump(errors), request)
75-
ctxLogger.Warn(stacktrace.NewError(msg))
75+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
7676
return h.responseUnprocessableEntity(c, errors, "validation errors while fetching usage history")
7777
}
7878

7979
heartbeats, err := h.service.GetUsageHistory(ctx, h.userIDFomContext(c), request.ToIndexParams())
8080
if err != nil {
8181
msg := fmt.Sprintf("cannot get billing usage history with params [%+#v]", request)
82-
ctxLogger.Error(stacktrace.Propagate(err, msg))
82+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
8383
return h.responseInternalServerError(c)
8484
}
8585

@@ -108,7 +108,7 @@ func (h *BillingHandler) Usage(c fiber.Ctx) error {
108108
billingUsage, err := h.service.GetCurrentUsage(ctx, h.userIDFomContext(c))
109109
if err != nil {
110110
msg := fmt.Sprintf("cannot get current usage record for user [%s]", h.userFromContext(c))
111-
ctxLogger.Error(stacktrace.Propagate(err, msg))
111+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
112112
return h.responseInternalServerError(c)
113113
}
114114

api/pkg/handlers/bulk_message_handler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (h *BulkMessageHandler) Index(c fiber.Ctx) error {
6868
orders, err := h.messageService.GetBulkMessages(ctx, h.userIDFomContext(c))
6969
if err != nil {
7070
msg := fmt.Sprintf("cannot fetch bulk messages for user [%s]", h.userIDFomContext(c))
71-
ctxLogger.Error(stacktrace.Propagate(err, msg))
71+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
7272
return h.responseInternalServerError(c)
7373
}
7474

@@ -96,19 +96,19 @@ func (h *BulkMessageHandler) Store(c fiber.Ctx) error {
9696
file, err := c.FormFile("document")
9797
if err != nil {
9898
msg := fmt.Sprintf("cannot fetch file with name [%s] from request", "document")
99-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
99+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
100100
return h.responseBadRequest(c, err)
101101
}
102102

103103
messages, userLocation, validationErrors := h.validator.ValidateStore(ctx, h.userIDFomContext(c), file)
104104
if len(validationErrors) != 0 {
105105
msg := fmt.Sprintf("validation errors [%s], while sending bulk sms from CSV file [%s] for [%s]", spew.Sdump(validationErrors), file.Filename, h.userIDFomContext(c))
106-
ctxLogger.Warn(stacktrace.NewError(msg))
106+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
107107
return h.responseUnprocessableEntity(c, validationErrors, "validation errors while sending bulk SMS")
108108
}
109109

110110
if msg := h.billingService.IsEntitledWithCount(ctx, h.userIDFomContext(c), uint(len(messages))); msg != nil {
111-
ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] is not entitled to send [%d] messages", h.userIDFomContext(c), len(messages))))
111+
ctxLogger.Warn(stacktrace.NewError("%s", fmt.Sprintf("user with ID [%s] is not entitled to send [%d] messages", h.userIDFomContext(c), len(messages))))
112112
return h.responsePaymentRequired(c, *msg)
113113
}
114114

@@ -136,7 +136,7 @@ func (h *BulkMessageHandler) Store(c fiber.Ctx) error {
136136
if err != nil {
137137
count.Add(-1)
138138
msg := fmt.Sprintf("cannot send message with payload [%s] at index [%d]", spew.Sdump(message), index)
139-
ctxLogger.Error(stacktrace.Propagate(err, msg))
139+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
140140
}
141141
wg.Done()
142142
}(message, perPhoneIndex)

api/pkg/handlers/discord_handler.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ func (h *DiscordHandler) Index(c fiber.Ctx) error {
8989
var request requests.DiscordIndex
9090
if err := c.Bind().Query(&request); err != nil {
9191
msg := fmt.Sprintf("cannot marshall URL [%s] into %T", c.OriginalURL(), request)
92-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
92+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
9393
return h.responseBadRequest(c, err)
9494
}
9595

9696
if errors := h.validator.ValidateIndex(ctx, request.Sanitize()); len(errors) != 0 {
9797
msg := fmt.Sprintf("validation errors [%s], while fetching discord integrations [%+#v]", spew.Sdump(errors), request)
98-
ctxLogger.Warn(stacktrace.NewError(msg))
98+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
9999
return h.responseUnprocessableEntity(c, errors, "validation errors while fetching discord integrations")
100100
}
101101

102102
discordIntegrations, err := h.service.Index(ctx, h.userIDFomContext(c), request.ToIndexParams())
103103
if err != nil {
104104
msg := fmt.Sprintf("cannot get discord integrations with params [%+#v]", request)
105-
ctxLogger.Error(stacktrace.Propagate(err, msg))
105+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
106106
return h.responseInternalServerError(c)
107107
}
108108

@@ -130,14 +130,14 @@ func (h *DiscordHandler) Delete(c fiber.Ctx) error {
130130
discordID := c.Params("discordID")
131131
if errors := h.validator.ValidateUUID(discordID, "discordID"); len(errors) != 0 {
132132
msg := fmt.Sprintf("validation errors [%s], while deleting discord integration with ID [%s]", spew.Sdump(errors), discordID)
133-
ctxLogger.Warn(stacktrace.NewError(msg))
133+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
134134
return h.responseUnprocessableEntity(c, errors, "validation errors while deleting discord integration")
135135
}
136136

137137
err := h.service.Delete(ctx, h.userIDFomContext(c), uuid.MustParse(discordID))
138138
if err != nil {
139139
msg := fmt.Sprintf("cannot delete discord integration with ID [%+#v]", discordID)
140-
ctxLogger.Error(stacktrace.Propagate(err, msg))
140+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
141141
return h.responseInternalServerError(c)
142142
}
143143

@@ -166,21 +166,21 @@ func (h *DiscordHandler) Update(c fiber.Ctx) error {
166166
var request requests.DiscordUpdate
167167
if err := c.Bind().Body(&request); err != nil {
168168
msg := fmt.Sprintf("cannot marshall params [%s] into [%T]", c.Body(), request)
169-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
169+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
170170
return h.responseBadRequest(c, err)
171171
}
172172

173173
request.DiscordID = c.Params("discordID")
174174
if errors := h.validator.ValidateUpdate(ctx, request.Sanitize()); len(errors) != 0 {
175175
msg := fmt.Sprintf("validation errors [%s], while updating user [%+#v]", spew.Sdump(errors), request)
176-
ctxLogger.Warn(stacktrace.NewError(msg))
176+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
177177
return h.responseUnprocessableEntity(c, errors, "validation errors while updating discord integration")
178178
}
179179

180180
user, err := h.service.Update(ctx, request.ToUpdateParams(h.userFromContext(c)))
181181
if err != nil {
182182
msg := fmt.Sprintf("cannot update discord integration with params [%+#v]", request)
183-
ctxLogger.Error(stacktrace.Propagate(err, msg))
183+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
184184
return h.responseInternalServerError(c)
185185
}
186186

@@ -210,31 +210,31 @@ func (h *DiscordHandler) Store(c fiber.Ctx) error {
210210
var request requests.DiscordStore
211211
if err := c.Bind().Body(&request); err != nil {
212212
msg := fmt.Sprintf("cannot marshall body [%s] into [%T]", c.Body(), request)
213-
ctxLogger.Warn(stacktrace.Propagate(err, msg))
213+
ctxLogger.Warn(stacktrace.Propagate(err, "%s", msg))
214214
return h.responseBadRequest(c, err)
215215
}
216216

217217
if errors := h.validator.ValidateStore(ctx, request.Sanitize()); len(errors) != 0 {
218218
msg := fmt.Sprintf("validation errors [%s], while storing discord integration [%+#v]", spew.Sdump(errors), request)
219-
ctxLogger.Warn(stacktrace.NewError(msg))
219+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
220220
return h.responseUnprocessableEntity(c, errors, "validation errors while storing discord integration")
221221
}
222222

223223
discordIntegrations, err := h.service.Index(ctx, h.userIDFomContext(c), repositories.IndexParams{Skip: 0, Limit: 1})
224224
if err != nil {
225-
ctxLogger.Error(stacktrace.Propagate(err, fmt.Sprintf("cannot index discord integrations for user [%s]", h.userIDFomContext(c))))
225+
ctxLogger.Error(stacktrace.Propagate(err, "%s", fmt.Sprintf("cannot index discord integrations for user [%s]", h.userIDFomContext(c))))
226226
return h.responseInternalServerError(c)
227227
}
228228

229229
if len(discordIntegrations) > 0 {
230-
ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] wants to create more than 1 discord integration", h.userIDFomContext(c))))
230+
ctxLogger.Warn(stacktrace.NewError("%s", fmt.Sprintf("user with ID [%s] wants to create more than 1 discord integration", h.userIDFomContext(c))))
231231
return h.responsePaymentRequired(c, "You can't create more than 1 discord integration contact us to upgrade your account.")
232232
}
233233

234234
discordIntegration, err := h.service.Store(ctx, request.ToStoreParams(h.userFromContext(c)))
235235
if err != nil {
236236
msg := fmt.Sprintf("cannot store discord integration with params [%+#v]", request)
237-
ctxLogger.Error(stacktrace.Propagate(err, msg))
237+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
238238
return h.responseInternalServerError(c)
239239
}
240240

@@ -264,7 +264,7 @@ func (h *DiscordHandler) Event(c fiber.Ctx) error {
264264
var payload map[string]any
265265
if err := json.Unmarshal(c.Body(), &payload); err != nil {
266266
msg := fmt.Sprintf("cannot unmarshall [%s] to [%T]", string(c.Body()), payload)
267-
ctxLogger.Error(h.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg)))
267+
ctxLogger.Error(h.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, "%s", msg)))
268268
return h.responseBadRequest(c, err)
269269
}
270270

@@ -278,7 +278,7 @@ func (h *DiscordHandler) Event(c fiber.Ctx) error {
278278
return h.sendSMS(ctx, c, payload)
279279
}
280280

281-
return h.responseBadRequest(c, stacktrace.NewError(fmt.Sprintf("unknown type [%d]", payload["type"])))
281+
return h.responseBadRequest(c, stacktrace.NewError("%s", fmt.Sprintf("unknown type [%d]", payload["type"])))
282282
}
283283

284284
func (h *DiscordHandler) createRequest(payload map[string]any) requests.MessageSend {
@@ -304,7 +304,7 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c fiber.Ctx, payload map[s
304304
discord, err := h.service.GetByServerID(ctx, payload["guild_id"].(string))
305305
if err != nil {
306306
msg := fmt.Sprintf("cannot get discord integration by server ID [%s]", payload["guild_id"].(string))
307-
ctxLogger.Error(h.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg)))
307+
ctxLogger.Error(h.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, "%s", msg)))
308308
return c.JSON(
309309
fiber.Map{
310310
"type": 4,
@@ -343,7 +343,7 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c fiber.Ctx, payload map[s
343343

344344
if errors := h.messageValidator.ValidateMessageSend(ctx, discord.UserID, request.Sanitize()); len(errors) != 0 {
345345
msg := fmt.Sprintf("validation errors [%s], while sending payload [%s]", spew.Sdump(errors), c.Body())
346-
ctxLogger.Warn(stacktrace.NewError(msg))
346+
ctxLogger.Warn(stacktrace.NewError("%s", msg))
347347

348348
var embeds []fiber.Map
349349
for _, value := range errors {
@@ -365,7 +365,7 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c fiber.Ctx, payload map[s
365365
}
366366

367367
if msg := h.billingService.IsEntitled(ctx, discord.UserID); msg != nil {
368-
ctxLogger.Warn(stacktrace.NewError(fmt.Sprintf("user with ID [%s] can't send a message", discord.UserID)))
368+
ctxLogger.Warn(stacktrace.NewError("%s", fmt.Sprintf("user with ID [%s] can't send a message", discord.UserID)))
369369
return c.JSON(
370370
fiber.Map{
371371
"type": 4,
@@ -385,7 +385,7 @@ func (h *DiscordHandler) sendSMS(ctx context.Context, c fiber.Ctx, payload map[s
385385
message, err := h.messageService.SendMessage(ctx, request.ToMessageSendParams(discord.UserID, c.OriginalURL()))
386386
if err != nil {
387387
msg := fmt.Sprintf("cannot send message with paylod [%s] from discord server [%s]", c.Body(), discord.ServerID)
388-
ctxLogger.Error(stacktrace.Propagate(err, msg))
388+
ctxLogger.Error(stacktrace.Propagate(err, "%s", msg))
389389
return c.JSON(
390390
fiber.Map{
391391
"type": 4,

0 commit comments

Comments
 (0)