Skip to content

Commit c454306

Browse files
refactor: revert changing function signature
1 parent c656b00 commit c454306

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

packages/core/src/exposed-thing.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,11 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
572572
*
573573
* @experimental
574574
*/
575-
public async handleUnsubscribeEvent(
575+
public handleUnsubscribeEvent(
576576
name: string,
577577
listener: ContentListener,
578578
options: WoT.InteractionOptions & { formIndex: number }
579-
): Promise<void> {
579+
): void {
580580
if (this.events[name] != null) {
581581
Helpers.validateInteractionOptions(this, this.events[name], options);
582582

@@ -595,7 +595,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
595595
}
596596
const unsubscribe = this.#eventHandlers.get(name)?.unsubscribe;
597597
if (unsubscribe) {
598-
await unsubscribe(options);
598+
unsubscribe(options).catch((error) => {
599+
throw error;
600+
});
599601
}
600602
debug(`ExposedThing '${this.title}' unsubscribes from event '${name}'`);
601603
} else {
@@ -639,11 +641,11 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
639641
}
640642
}
641643

642-
public async handleUnobserveProperty(
644+
public handleUnobserveProperty(
643645
name: string,
644646
listener: ContentListener,
645647
options: WoT.InteractionOptions & { formIndex: number }
646-
): Promise<void> {
648+
): void {
647649
if (this.properties[name] != null) {
648650
Helpers.validateInteractionOptions(this, this.properties[name], options);
649651
const formIndex = ProtocolHelpers.getFormIndexForOperation(
@@ -663,7 +665,9 @@ export default class ExposedThing extends TD.Thing implements WoT.ExposedThing {
663665

664666
const unobserveHandler = this.#propertyHandlers.get(name)?.unobserveHandler;
665667
if (unobserveHandler) {
666-
await unobserveHandler(options);
668+
unobserveHandler(options).catch((error) => {
669+
throw error;
670+
});
667671
}
668672
} else {
669673
throw new Error(`ExposedThing '${this.title}', no property found for '${name}'`);

0 commit comments

Comments
 (0)