Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78554

Exceptions thrown in Promise.then()'s onRejected not handled properly

    XMLWordPrintable

    Details

    • Commits:
      36be27265d61c76b25417a25e482030e30ff380f (qt/qtdeclarative/5.13)

      Description

      I'm facing a bug in Qt's Promise implementation. Exceptions thrown from the second argument of Promise.prototype.then()'s argument aren't propagated to the following .catch() statement.

      I have a simple test case:

      Promise.reject("Some error")
      .then(
           o => console.log("Never reached"),
           err => {
               console.log("Rethrowing err");
               throw err;
           }   
      )   
      .catch(err => {
          console.error("The error is: " + err);
      }); 
      

      This is what it should print:

      Rethrowing err
      The error is: Some error
      

      and it does so under Node.js and Mozilla Firefox.

      However, it only prints the first line under Qt, because the .catch() part isn't run at all.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              fabiankosmale Fabian Kosmale
              Reporter:
              lubosd Lubos Dolezel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes