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

Error objects should capture stack at the constructor

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      generic
    • OS:
      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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: