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

Final steps to have Error compliant with V8 Error API

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      The list of missing features to have node modules that rely on v8 error API(specified by : http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi) to work properly.

      Points1) 2) 4) and 5) are must have and can't be implemented in avatar-is without Nashorn support.

      1) Error constructor should capture the stack.
      2) Error constructor should call prepareStackTrace.
      3) captureStackTrace should call prepareStackTrace.
      4) captureStackTrace should support option argument (a function to limit stackTrace). e.g.: Error.captureStackTrace(obj, arguments.callee);
      5) Support for Callsite properties. The most properties we can get, we will not have all.
      6) Stack filename shouldn't be an URL, file/xxx ==> /xxx, some modules load file from the filesystem using this information...
      7) Support for Error.stackTraceLimit, optional, didn't find a module using it. But we could.
      8) stack property of an Error shouldn't be replaced when throwing this error
      9) Error properties are not enumerable, Object.keys called on an Error instance returns an empty array.

      Typical rethrow case:
      var backtrace = new Error;
      Error.captureStackTrace(backtrace);
      doit();
      function doit() {
          throw backtrace;//doit function not in the stack!
      }

      Typical stack customisation:
      function getStackofCallSites() {
      var orig = Error.prepareStackTrace;
      Error.prepareStackTrace = function(_, stack){ return stack; };
      var err = {};
      Error.captureStackTrace(err, arguments.callee);
      Error.prepareStackTrace = orig;
      return err.stack;
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sundar Sundararajan Athijegannathan
                Reporter:
                jfdenise Jean-Francois Denise (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: