ember.js: debugging run loop stacktraces is not dev friendly, is it possible to add function arguments?

Hello,

Debugging in Ember is very cumbersome due to the run loop.

We have the stack trace but it is not always useful to understand from which part of the application code the exceptions come from - we have the line number but not the data used.

For example, for this regular exception:

  Error: Assertion Failed: calling set on destroyed object
    at new Error (native)
    at Error.EmberError (http://localhost:3000/assets/frontend/vendor.js:22060:21)
    at Object.Ember.default.assert (http://localhost:3000/assets/frontend/vendor.js:15395:13)
    at Object.set (http://localhost:3000/assets/frontend/vendor.js:25870:24)
    at exports.default.mixin.Mixin.create.set (http://localhost:3000/assets/frontend/vendor.js:39863:20)
    at Ember.Object.extend.flushCanonical (http://localhost:3000/assets/frontend/vendor.js:86749:14)
    at ember$data$lib$system$relationships$state$has$many$$ManyRelationship.flushCanonical (http://localhost:3000/assets/frontend/vendor.js:87069:22)
    at Queue.invoke (http://localhost:3000/assets/frontend/vendor.js:11433:18)
    at Object.Queue.flush (http://localhost:3000/assets/frontend/vendor.js:11498:13)
    at Object.DeferredActionQueues.flush (http://localhost:3000/assets/frontend/vendor.js:11303:19)"

For every new release of Ember, I overwrite ember-debug with the following lines:

  function set(obj, keyName, value, tolerant) {
    (...)
    if (obj.isDestroyed) {
      log("LV ember set "+keyName+" on destroyed object, returning false:","red");
      log(obj);
      return false;
      //Ember['default'].assert("calling set on destroyed object", !obj.isDestroyed);
    }

which tells me which object created the exception and the property who is getting set.

Is it naive to ask if such objects could be added in the EmberError stacks, if this is possible technically (not sure in javascript strict mode) with a routine which would systematically add the arguments of the function being called and the context - this would cover most of the cases. If not, maybe try to add more information on the most frequent errors in the run loop?

Thanks.

https://github.com/emberjs/ember.js/issues/2817

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 26 (25 by maintainers)

Most upvoted comments

So, i basically stopped working on the long stack stitching stuff when i realize there was no way to make chrome print it by default… We have been working with the chrome folks on making custom printers, so things like ember inspector could provide higher fidelity output. This may be an avenue to fix this issue, if/when it lands I will be more motivated to work on this.

In addition the chrome folks are apparently going to be working on an ability for user land libs, to annotate/inform the runtime of source stacks, which in theory would allow both errors and the stack explorer to work as expected. They are interested in pursuing this I hope it lands.

We should revisit if either of the above two become available. (or if a different solution is presented)