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

error.stack should be a string rather than an array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • None
    • core-libs
    • None
    • b98
    • generic
    • generic
    • Verified

      error.stack is a string where frame info is separated by "\n" chars in other implementations. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack

      In Nashorn, error.stack evaluates to an array of StackTraceElement objects. It is better if we follow other implementation to be compatible. We could add Error.prototype.getStackTrace function which returns array of StackTraceElement for script frames (just like java.lang.Throwable.getStackTrace() returns an array of all frames).

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

              Created:
              Updated:
              Resolved: