eclipsesource / eclipsesource/tabris-js

Incomplete stack trace of errors thrown in async functions

Open
#2,001 1 comment 0 reactions 1 assignee Claimed by @tbuschto View on GitHub
js
Dominant language
JavaScript
Stars
1.4k
Forks
171
PR merge metrics
No merged PRs in 30d

Description

```
import {contentView, Button} from 'tabris';

contentView.append(
Push
);

async function test() {
await new Promise(r => setTimeout(r, 100));
await test2();
}

async function test2() {
await new Promise(r => setTimeout(r, 100));
throw new Error('foo');
}
```
Prints:
```
Listener for Button event "select" rejected:
Error: foo
at ./test.jsx:14:9
```

Should print something like
```
Listener for Button event "select" rejected:
Error: foo
at ./test.jsx:9:3
at ./test.jsx:14:9
```

Tabris.js does keep snapshots of the stack trace at the moment a promise is created and sets it as "current" while the promise resolves, but when the error is formatted the promise has already resolved (rejected) and the snapshot is no longer "current"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.