diff --git a/apps/server/src/infra/etherpad-client/etherpad-client.adapter.spec.ts b/apps/server/src/infra/etherpad-client/etherpad-client.adapter.spec.ts index a85501f9357..e8708d5ca88 100644 --- a/apps/server/src/infra/etherpad-client/etherpad-client.adapter.spec.ts +++ b/apps/server/src/infra/etherpad-client/etherpad-client.adapter.spec.ts @@ -995,7 +995,12 @@ describe(EtherpadClientAdapter.name, () => { it('should throw EtherpadErrorLoggableException', async () => { const groupId = setup(); - const exception = new EtherpadErrorLoggableException(EtherpadErrorType.INTERNAL_ERROR, { padId: groupId }, {}); + const exception = new EtherpadErrorLoggableException( + EtherpadErrorType.INTERNAL_ERROR, + { padId: groupId }, + undefined, + {} + ); await expect(service.deleteGroup(groupId)).rejects.toThrowError(exception); }); }); @@ -1084,7 +1089,12 @@ describe(EtherpadClientAdapter.name, () => { it('should throw EtherpadErrorLoggableException', async () => { const sessionId = setup(); - const exception = new EtherpadErrorLoggableException(EtherpadErrorType.BAD_REQUEST, { sessionId }, {}); + const exception = new EtherpadErrorLoggableException( + EtherpadErrorType.BAD_REQUEST, + { sessionId }, + undefined, + {} + ); await expect(service.deleteSession(sessionId)).rejects.toThrowError(exception); }); }); @@ -1150,7 +1160,7 @@ describe(EtherpadClientAdapter.name, () => { it('should throw EtherpadErrorLoggableException', async () => { const padId = setup(); - const exception = new EtherpadErrorLoggableException(EtherpadErrorType.BAD_REQUEST, { padId }, {}); + const exception = new EtherpadErrorLoggableException(EtherpadErrorType.BAD_REQUEST, { padId }, undefined, {}); await expect(service.deletePad(padId)).rejects.toThrowError(exception); }); }); diff --git a/apps/server/src/infra/etherpad-client/loggable/etherpad-error-loggable-exception.ts b/apps/server/src/infra/etherpad-client/loggable/etherpad-error-loggable-exception.ts index 93fa4140076..4ce8c6ba1da 100644 --- a/apps/server/src/infra/etherpad-client/loggable/etherpad-error-loggable-exception.ts +++ b/apps/server/src/infra/etherpad-client/loggable/etherpad-error-loggable-exception.ts @@ -6,6 +6,7 @@ export class EtherpadErrorLoggableException extends InternalServerErrorException constructor( private readonly type: EtherpadErrorType, private readonly payload: EtherpadParams, + private readonly originalMessage: string | undefined, private readonly exceptionOptions: HttpExceptionOptions ) { super(type, exceptionOptions); @@ -20,6 +21,7 @@ export class EtherpadErrorLoggableException extends InternalServerErrorException data: { userId, parentId, + originalMessage: this.originalMessage, }, }; diff --git a/apps/server/src/infra/etherpad-client/loggable/etherpad-server-error-exception.spec.ts b/apps/server/src/infra/etherpad-client/loggable/etherpad-server-error-exception.spec.ts index 63cbfadfabb..b81c0398ed5 100644 --- a/apps/server/src/infra/etherpad-client/loggable/etherpad-server-error-exception.spec.ts +++ b/apps/server/src/infra/etherpad-client/loggable/etherpad-server-error-exception.spec.ts @@ -13,7 +13,7 @@ describe('EtherpadErrorLoggableException', () => { const error = new Error('error'); const httpExceptionOptions = ErrorUtils.createHttpExceptionOptions(error); - const exception = new EtherpadErrorLoggableException(type, payload, httpExceptionOptions); + const exception = new EtherpadErrorLoggableException(type, payload, 'hugo ist nudeln', httpExceptionOptions); const result = exception.getLogMessage(); expect(result).toStrictEqual({ @@ -22,6 +22,7 @@ describe('EtherpadErrorLoggableException', () => { data: { userId: 'userId', parentId: 'parentId', + originalMessage: 'hugo ist nudeln', }, }); }); diff --git a/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts b/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts index cadab81fc7f..0857b3c502b 100644 --- a/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts +++ b/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts @@ -62,7 +62,12 @@ export class EtherpadResponseMapper { payload: EtherpadParams, response: T | Error ): EtherpadErrorLoggableException { - return new EtherpadErrorLoggableException(type, payload, ErrorUtils.createHttpExceptionOptions(response.message)); + return new EtherpadErrorLoggableException( + type, + payload, + response.message, + ErrorUtils.createHttpExceptionOptions(response.message) + ); } static mapEtherpadSessionsToSessions(etherpadSessions: unknown): Session[] {