Cloud-side JavaScript "Promise" handling update

2018-07-03 06:16:00
87487
0

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:

AI.detectVoicemail(call)
  .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:

AI.detectVoicemail(call)
  .then(e => {/* This code is executed if voicemail is detected */})
  .catch(e => {/* This code is executed if voicemail is NOT detected */});
Sign Up for a free Voximplant developer account or talk to our experts

Add your comment

Name*
Email*
Message

Your comment has been added and will be published after moderation.

Recommended posts

5 Tactics to Strengthen Your Contact Center Operations with Technology

5 Tactics to Strengthen Your Contact Center Operations with Technology

In our fast-paced, digitally focused world, customers want personalized service at lightning speed. A Hubspot survey of 1,000 customers found that 90% of people expect a response from a live customer service agent in ten minutes or less. Because expectations are so high, the pressure is on for customer service agents to consistently provide quick, high-quality customer experiences. Offering an elevated level of service with such a fast turnaround is next to impossible with manual support alone. And even if you have some digital tools in your tech stack, traditional contact center technology can fall short when it comes to efficiency. That’s why choosing no-fuss technology that automates your contact center’s routine operations is essential for making tasks more manageable for your agents.

Speech Technologies For Your Business – The Future of CX

Speech Technologies For Your Business – The Future of CX

Striving to offer the best service possible, contact centers are usually very quick to adopt new technologies and try out innovative solutions. Successful implementation of speech technologies can create a great competitive advantage for a company.