From b43556c4d44c26bce8c4039bee2d28870a893240 Mon Sep 17 00:00:00 2001 From: lilla28 Date: Mon, 2 Sep 2024 17:58:17 +0200 Subject: [PATCH] fix(fdc3) - Removing console.log messages, reverted back Fdc3StoreIntentResult message to IntentHandlerRejected --- .../js/composeui-fdc3/src/infrastructure/ComposeUIChannel.ts | 2 -- .../src/infrastructure/ComposeUIContextListener.ts | 1 - .../src/infrastructure/ComposeUIIntentListener.ts | 5 +++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIChannel.ts b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIChannel.ts index e8bd0e6ad..fe2dbfbcf 100644 --- a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIChannel.ts +++ b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIChannel.ts @@ -40,7 +40,6 @@ export class ComposeUIChannel implements Channel { this.lastContexts.set(context.type, context); this.lastContext = context; const topic = ComposeUITopic.broadcast(this.id, this.type); - console.log("Broadcast from channel: ", this.id, this.type, topic, context); await this.messageRouterClient.publish(topic, JSON.stringify(context)); } @@ -80,7 +79,6 @@ export class ComposeUIChannel implements Channel { const listener = new ComposeUIContextListener(this.messageRouterClient, handler, this.id, this.type, contextType); await listener.subscribe(); - console.log("ContextListener has been added through channel:", contextType); return listener; } } \ No newline at end of file diff --git a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIContextListener.ts b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIContextListener.ts index 2a1dbccd1..8e7a38c67 100644 --- a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIContextListener.ts +++ b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIContextListener.ts @@ -44,7 +44,6 @@ export class ComposeUIContextListener implements Listener { //TODO: integration test const context = JSON.parse(topicMessage.payload!); if (!this.contextType || this.contextType == context!.type) { - console.log("ContextListener received context to handle: ", context); this.handler!(context!); } }); diff --git a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIIntentListener.ts b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIIntentListener.ts index 51ce8019d..70f8df194 100644 --- a/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIIntentListener.ts +++ b/src/fdc3/js/composeui-fdc3/src/infrastructure/ComposeUIIntentListener.ts @@ -48,7 +48,7 @@ export class ComposeUIIntentListener implements Listener { const result = this.intentHandler(message.context, message.contextMetadata); if (result && result instanceof Promise) { const intentResult = await result; - if (!intentResult) { //Promise + if (!intentResult) { request = new Fdc3StoreIntentResultRequest(message.messageId, this.intent, this.instanceId, message.contextMetadata.source.instanceId!, undefined, undefined, undefined, true); } else if ('id' in intentResult) { const channel = intentResult; @@ -64,7 +64,7 @@ export class ComposeUIIntentListener implements Listener { } } catch (error) { console.error(error); - request = new Fdc3StoreIntentResultRequest(message.messageId, this.intent, this.instanceId, message.contextMetadata.source.instanceId!, undefined, undefined, undefined, false, error as string); + request = new Fdc3StoreIntentResultRequest(message.messageId, this.intent, this.instanceId, message.contextMetadata.source.instanceId!, undefined, undefined, undefined, false, ResultError.IntentHandlerRejected); } const result = await this.messageRouterClient.invoke(ComposeUITopic.sendIntentResult(), JSON.stringify(request)); @@ -74,6 +74,7 @@ export class ComposeUIIntentListener implements Listener { const response = (JSON.parse(result)); if (response.error || !response.stored) { console.log("Error while resolving the intent.", response.error); + throw new Error(response.error); } } });