question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

catch uncaught (in promise)

See original GitHub issue

The async function to handle init event cannot catch promise rejection error inside try - catch block. Seems like the reject method was not implemented in promise object passed. I used the sample in its doc as:

 methods: {
  async onInit (promise) {
    // show loading indicator
    try {
      await promise
      // successfully initialized
    } catch (error) {
      if (error.name === 'NotAllowedError') {
        // user denied camera access permisson
      } else if (error.name === 'NotFoundError') {
        // no suitable camera device installed
      } else if (error.name === 'NotSupportedError') {
        // page is not served over HTTPS (or localhost)
      } else if (error.name === 'NotReadableError') {
        // maybe camera is already in use
      } else if (error.name === 'OverconstrainedError') {
        // passed constraints don't match any camera. Did you requested the front camera although there is none?
      } else {
        // browser is probably lacking features (WebRTC, Canvas)
      }
    } finally {
      // hide loading indicator
    }
  }
}

I get the console error in chrome:

Uncaught (in promise) vue-qrcode-reader.common.js?1730:1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
gruhncommented, Feb 17, 2018

I see! Haha 😁 don’t worry.

FYI you can also simply write <QrcodeReader @init="onInit($event)" /> if you find this more convenient.

2reactions
michael-erwincommented, Feb 17, 2018

Wow I didn’t know that! Thanks for the helpful tip & support. +1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to catch uncaught exception in Promise - Stack Overflow
The Golden Rule of done vs. then usage is: either return your promise to someone else, or if the chain ends with you,...
Read more >
Error handling with promises - The Modern JavaScript Tutorial
The "invisible try..catch " around the executor automatically catches the error and turns it into rejected promise. This happens not only in the ......
Read more >
Promise.prototype.catch() - JavaScript - MDN Web Docs
The catch() method of a Promise object schedules a function to be called when the promise is rejected. It immediately returns an equivalent ......
Read more >
Promises - Error Handling - Beginner JavaScript - Wes Bos
The way you catch an error in a promise is you chain a .catch() to it. Catch will pass you the ... catching...
Read more >
Promise Error Handling - JavaScript Tutorial
Inside the promise, the catch() method will catch the error caused by the throw statement and reject() . · If an error occurs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found