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

Documentation of QJSValue::isError() contradicts QJSEngine::evaluate()

    XMLWordPrintable

Details

    • 0e929f49d716c76aec796a18b450c78842353b32

    Description

      bool QJSValue::isError() const
      Returns true if this QJSValue is an object of the Error class; otherwise returns false.

      contradicts

      QJSValue QJSEngine::evaluate(const QString & program, const QString & fileName = QString(), int lineNumber = 1)
      You can call isError() on the return value to determine whether an exception occurred.

      Consider the two snippets:

      a) return new Error();

      and

      b) throw "This is a string";

      Judging from the QJSValue's documentation, isError() should return a) true and b) false

      Judging from the QJSEngine's documentation, isError() should return a) false and b) true

      What's it gonna be? Should isError() really be a wasThrown() ?

      Attachments

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

        Activity

          People

            kenthans Kent Hansen (Inactive)
            sixtus42 Hagen Rother
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes