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; } } 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}`, ); }); });