Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Connection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ class Connection extends Emittery {
}

if (!this.hasSubscription(topic)) {
throw new Error(`Topic ${topic} doesn't have any active subscriptions`)
debug('Topic %s doesn\'t have any active subscriptions', topic)
}

return msp.eventPacket(topic, event, data)
Expand Down
6 changes: 3 additions & 3 deletions test/unit/connection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,16 @@ test.group('Connection', (group) => {
helpers.startClient()
})

test('return hard error when topic has no active subscriptions on a connection', (assert, done) => {
test('does not return hard error when topic has no active subscriptions on a connection', (assert, done) => {
assert.plan(1)

this.ws = helpers.startWsServer()

this.ws.on('connection', (ws, req) => {
const connection = new Connection(ws, req, JsonEncoder)
const fn = () => connection.sendEvent('chat')
const fn = () => connection.sendEvent('chat', 'message')
done(() => {
assert.throw(fn, 'Topic chat doesn\'t have any active subscriptions')
assert.doesNotThrow(fn)
})
})

Expand Down