Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15579 closed defect (fixed)

instrumenting does not log strings

Reported by: Adam Peller Owned by: bill
Priority: undecided Milestone: 1.8
Component: Dijit Version: 1.8.0b1
Keywords: Cc: Mark Wubben
Blocked By: Blocking:

Description

dijit/Tree _setPathsAttr does stuff like

				def.reject("Could not expand path at " + nextPath);

passing a string to reject. instrumenting.js only seems to know how to log error objects, looking for error.stack. If passed just a string, an empty console.error is issued. Is this a proper use of the Deferred API? If so, perhaps this is a Deferred issue and instrumenting.js should handle strings?

Change History (5)

comment:1 Changed 7 years ago by Adam Peller

Cc: Mark Wubben added

comment:2 Changed 7 years ago by Mark Wubben

Version: 1.7.31.8.0b1

It could certainly cast the error object to a string. This is what I tend to do normally:

console.error(error && error.stack || error);

Because instrumenting also tries to log a stack trace we can't quite do that, so I'll just cast it to a string.

Generally though I think promises should only be rejected with non-error values if the rejection is used as a way to short-circuit a part of the promise chain. You could throw a result object so 5 other normal callbacks don't get called. In this particular case we're dealing with an actual error, so it should be an error instance not a string.

comment:3 Changed 7 years ago by bill

Milestone: tbd1.8
Status: newassigned

OK, I'll fix, thanks for catching the problem.

comment:4 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [29086]:

reject() should be called with an Error, not a String, fixes #15579 !strict

comment:5 Changed 7 years ago by Mark Wubben

In [29170]:

Log original error, as well as any stack trace

Refs #14615, #15579 !strict

Note: See TracTickets for help on using tickets.