From fe9c9ad683f16230ccb878ae17e5a3eb7d1d77c2 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Thu, 8 Oct 2026 09:16:42 +0200 Subject: [PATCH 1/2] fix: add error message to the error log --- .../events/invoices/InvoiceCompletedHandler.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/webhooks/events/invoices/InvoiceCompletedHandler.ts b/src/webhooks/events/invoices/InvoiceCompletedHandler.ts index 190756a3..b7a44108 100644 --- a/src/webhooks/events/invoices/InvoiceCompletedHandler.ts +++ b/src/webhooks/events/invoices/InvoiceCompletedHandler.ts @@ -375,9 +375,9 @@ export class InvoiceCompletedHandler { await this.tiersService.applyDriveFeatures(user, tierToApply, lifetimeMaxSpaceBytesToApply); Logger.info(`Drive features applied for user ${user.uuid} with customerId ${customer.id}`); } catch (error) { - Logger.error(`Failed to apply drive features for user ${user.uuid} with customerId ${customer.id}`, { - error: (error as Error).message, - }); + Logger.error( + `Failed to apply drive features for user ${user.uuid} with customerId ${customer.id}. Error: ${(error as Error).message}`, + ); throw error; } @@ -386,9 +386,9 @@ export class InvoiceCompletedHandler { await this.tiersService.applyVpnFeatures(user, tierToApply); Logger.info(`VPN features applied for user ${user.uuid} with customerId ${customer.id}`); } catch (error) { - Logger.error(`Failed to apply VPN features for user ${user.uuid} with customerId ${customer.id}`, { - error: (error as Error).message, - }); + Logger.error( + `Failed to apply VPN features for user ${user.uuid} with customerId ${customer.id}. Error: ${(error as Error).message}`, + ); throw error; } @@ -397,9 +397,9 @@ export class InvoiceCompletedHandler { await this.tiersService.applyMailFeatures(user, tierToApply); Logger.info(`Mail features applied for user ${user.uuid} with customerId ${customer.id}`); } catch (error) { - Logger.error(`Failed to apply Mail features for user ${user.uuid} with customerId ${customer.id}`, { - error: (error as Error).message, - }); + Logger.error( + `Failed to apply Mail features for user ${user.uuid} with customerId ${customer.id}. Error: ${(error as Error).message}`, + ); throw error; } } From 00dd51d9831f817c7d5230d1f242c0ddcb9f6def Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Thu, 8 Oct 2026 09:33:14 +0200 Subject: [PATCH 2/2] fix: log in tests --- .../events/invoices/InvoiceCompletedHandler.test.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/src/webhooks/events/invoices/InvoiceCompletedHandler.test.ts b/tests/src/webhooks/events/invoices/InvoiceCompletedHandler.test.ts index cd7bd4da..a25a7ca6 100644 --- a/tests/src/webhooks/events/invoices/InvoiceCompletedHandler.test.ts +++ b/tests/src/webhooks/events/invoices/InvoiceCompletedHandler.test.ts @@ -695,10 +695,7 @@ describe('Testing the handler when an invoice is completed', () => { }), ).rejects.toThrow(mockedError); expect(loggerSpy).toHaveBeenCalledWith( - `Failed to apply drive features for user ${mockedUser.uuid} with customerId ${mockedCustomer.id}`, - { - error: mockedError.message, - }, + `Failed to apply drive features for user ${mockedUser.uuid} with customerId ${mockedCustomer.id}. Error: ${mockedError.message}`, ); }); @@ -730,10 +727,7 @@ describe('Testing the handler when an invoice is completed', () => { }), ).rejects.toThrow(mockedError); expect(loggerSpy).toHaveBeenCalledWith( - `Failed to apply VPN features for user ${mockedUser.uuid} with customerId ${mockedCustomer.id}`, - { - error: mockedError.message, - }, + `Failed to apply VPN features for user ${mockedUser.uuid} with customerId ${mockedCustomer.id}. Error: ${mockedError.message}`, ); }); });