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

Error objects should capture stack at the constructor

XMLWordPrintable

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

        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)



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

                Created:
                Updated:
                Resolved: