From 3b165d69d91be1c86d9a9e09770411f5fbdc66c5 Mon Sep 17 00:00:00 2001 From: "Marc J. Schmidt" Date: Mon, 30 Oct 2023 22:15:59 +0100 Subject: [PATCH] fix(framework): dont throw when profiler package couldn't be built. fix also integration tests by disabling profiler --- packages/framework-integration/tests/util.ts | 1 + packages/framework/src/rpc.ts | 9 ++++++--- packages/framework/tests/stopwatch.spec.ts | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/framework-integration/tests/util.ts b/packages/framework-integration/tests/util.ts index 0191884b9..bab317b64 100644 --- a/packages/framework-integration/tests/util.ts +++ b/packages/framework-integration/tests/util.ts @@ -82,6 +82,7 @@ export async function createServerClientPair( AppModule.configure({ framework: { server: server, + debugProfiler: false, broker: { listen: exchangeSocketPath }, } }) diff --git a/packages/framework/src/rpc.ts b/packages/framework/src/rpc.ts index db5915541..4f89be0f8 100644 --- a/packages/framework/src/rpc.ts +++ b/packages/framework/src/rpc.ts @@ -48,9 +48,12 @@ export class RpcServerActionWithStopwatch extends RpcServerAction { const body = message.parseBody(); const frame = this.stopwatch ? this.stopwatch.start(body.method + '() [' + body.controller + ']', FrameCategory.rpc, true) : undefined; if (frame) { - const types = await this.loadTypes(body.controller, body.method); - const value: { args: any[] } = message.parseBody(types.actionCallSchema); - frame.data({ method: body.method, controller: body.controller, arguments: value.args }); + try { + const types = await this.loadTypes(body.controller, body.method); + const value: { args: any[] } = message.parseBody(types.actionCallSchema); + frame.data({ method: body.method, controller: body.controller, arguments: value.args }); + } catch { + } } try { diff --git a/packages/framework/tests/stopwatch.spec.ts b/packages/framework/tests/stopwatch.spec.ts index 8210686e1..a47d8e92d 100644 --- a/packages/framework/tests/stopwatch.spec.ts +++ b/packages/framework/tests/stopwatch.spec.ts @@ -15,6 +15,6 @@ test('encode/decode', async () => { console.log('data', data); const http = deserializeFrameData(data) as FrameCategoryData[FrameCategory.http]; console.log('http', http); - expect(http).toEqual({ method: 'GET', clientIp: '127.0.0.01' }); + expect(http).toEqual({ method: 'GET', clientIp: '127.0.0.1' }); }); });