Omnichannel Cloud Contact Center
Cloud-side JavaScript "Promise" handling update

Cloud-side JavaScript "Promise" handling update

We are making our VoxEngine Cloud-side JavaScript API more standard compliant! Starting August 2018 rejected promises without a "catch" clause will trigger a scenario stop with an "Unhandled promise rejection" message. This brings our JavaScript engine in line with modern web browsers, making it easier to write correct scenarios. Not handling an exception at the root level or not handling a rejected promise at the root level is now handled the same way by explicitly notifying developers about possible problems with their code flow logic.

Before August 2018 update rejected top-level promises are not handled by our JavaScript engine:

  .then(e => {/* This code is executed if voicemail is detected */});
// But what happens if voicemail is NOT detected? Nothing. And that is wrong

After August 2018 update, the code above will stop JavaScript scenarios in case of a rejected promise, so developers can see an error message. The following code allows to explicitly specify what to do if a promise is rejected:

  .then(e => {/* This code is executed if voicemail is detected */})
  .catch(e => {/* This code is executed if voicemail is NOT detected */});
B6A24216-9891-45D1-9D1D-E7359CEB8282 Created with sketchtool.
Add your comment

Please complete this field.

Sign Up for a free Voximplant developer account or talk to our experts