Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8031983

Error objects should capture stack at the constructor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • core-libs
    • None
    • b02
    • generic
    • generic

    Backports

      Description

        Error, TypeError etc. capture stack trace at the time of throwing the exception. This is inconsistent with Java as well as other js implementations like v8.

        File: test.js

        var e = new Error();

        print("hello");

        try {
            throw e;
        } catch (e) {
            print(e.stack);
        }

        --- output --
        hello
        Error
        at <program> (test.js:6)

        -- expected --
        hello
        Error
        at <program> (test.js:1)



        Attachments

          Issue Links

            Activity

              People

                sundar Sundararajan Athijegannathan
                sundar Sundararajan Athijegannathan
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: