Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit c912bc4

Browse files
christophebedardMinggang Wang
authored andcommitted
Use clearer error message when publishing without first advertising
1 parent a867428 commit c912bc4

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/bridge.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class Bridge extends EventEmitter {
189189
this._registerOpMap('publish', (command) => {
190190
debug(`Publish a topic named ${command.topic} with ${JSON.stringify(command.msg)}`);
191191

192+
if (!this._topicsPublished.has(command.topic)) {
193+
let error = new Error(`The topic ${command.topic} does not exist`);
194+
error.level = 'error';
195+
throw error;
196+
}
192197
let publisher = this._resourceProvider.getPublisherByTopicName(command.topic);
193198
if (publisher) {
194199
publisher.publish(command.msg);

0 commit comments

Comments
 (0)