Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 26a4dc2

Browse files
committed
feat(lstz): allow getLongStacktrace to be called with zero args
Closes #47
1 parent 643f2ac commit 26a4dc2

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Diff for: long-stack-trace-zone.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ Zone.longStackTraceZone = {
4646
getLongStacktrace: function (exception) {
4747
var trace = [];
4848
var zone = this;
49-
if (zone.stackFramesFilter) {
50-
trace.push(exception.stack.split('\n').
51-
filter(zone.stackFramesFilter).
52-
join('\n'));
53-
} else {
54-
trace.push(exception.stack);
49+
if (exception) {
50+
if (zone.stackFramesFilter) {
51+
trace.push(exception.stack.split('\n').
52+
filter(zone.stackFramesFilter).
53+
join('\n'));
54+
} else {
55+
trace.push(exception.stack);
56+
}
5557
}
5658
var now = Date.now();
5759
while (zone && zone.constructedAtException) {

Diff for: test/long-stack-trace-zone.spec.js

+4
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ describe('longStackTraceZone', function () {
4646
}, 0);
4747
});
4848
});
49+
50+
it('should expose LST via getLogStackTrace', function () {
51+
expect(lstz.getLongStacktrace()).toBeDefined();
52+
});
4953
});

0 commit comments

Comments
 (0)