Skip to content

Commit

Permalink
fix(fdc3) - Removing console.log messages, reverted back Fdc3StoreInt…
Browse files Browse the repository at this point in the history
…entResult message to IntentHandlerRejected
  • Loading branch information
lilla28 committed Sep 2, 2024
1 parent fce3f99 commit b43556c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export class ComposeUIContextListener implements Listener {
//TODO: integration test
const context = <Context>JSON.parse(topicMessage.payload!);
if (!this.contextType || this.contextType == context!.type) {
console.log("ContextListener received context to handle: ", context);
this.handler!(context!);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ComposeUIIntentListener implements Listener {
const result = this.intentHandler(message.context, message.contextMetadata);
if (result && result instanceof Promise) {
const intentResult = <object>await result;
if (!intentResult) { //Promise<void>
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 = <Channel>intentResult;
Expand All @@ -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));
Expand All @@ -74,6 +74,7 @@ export class ComposeUIIntentListener implements Listener {
const response = <Fdc3StoreIntentResultResponse>(JSON.parse(result));
if (response.error || !response.stored) {
console.log("Error while resolving the intent.", response.error);
throw new Error(response.error);
}
}
});
Expand Down

0 comments on commit b43556c

Please sign in to comment.