🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

handle Throw error in Pub/Sub Pattern in Javascript

TestUserName
TestUserName Member Posts: 2

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 ?

Comments

  • giri
    giri Member, Administrator, Employee Posts: 116 admin

    Hi, The session/connection status are made available via callbacks on the session and that is the only way it works. If you could give sample snippet as to how you want this to be, maybe we can suggest/explore more.