Skip to content

Commit 7271b55

Browse files
author
Stefan-Gabriel Muscalu
committed
Update: [Result] Keep only the caller's stack trace, discard the old one
1 parent 87b644e commit 7271b55

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/v1/result.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ class Result {
138138
// notify connection holder that the used connection is not needed any more because error happened
139139
// and result can't bee consumed any further; call the original onError callback after that
140140
self._connectionHolder.releaseConnection().then(() => {
141-
error.stack = error.stack + '\n' + this._stack;
141+
// Error.prototype.toString() concatenates error.name and error.message nicely
142+
// then we add the rest of the stack trace
143+
error.stack = error.toString() + '\n' + this._stack;
142144
onErrorOriginal.call(observer, error);
143145
});
144146
};

test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
/**
3+
(test:File)<-[:MADE {on: 26/10/2017}]-(Stefan:Coder)
4+
*/

0 commit comments

Comments
 (0)