handle Throw error in Pub/Sub Pattern in Javascript

TestUserName
Wed, 17 Apr 2024 20:49:13 +0000
Solace Event Broker

Hello,

I am trying to get my head around how error with a publisher in javascript.

When I invoke a failed connection via false credentials the following code snippet is executed in the Publisher code:
publisher.session.on(solace.SessionEventCode.CONNECT_FAILED_ERROR, function (sessionEvent) {

publisher.log(‘Connection failed to the message router: ’ + sessionEvent.infoStr + ’ - check correct parameter values and connectivity!’);

});

i want to catch that error in a try-catch block, just putting a throw new Error does not propagate into a parent try-catch.

can you help me out ?

2 posts - 1 participant