DioxusLabs / DioxusLabs/dioxus
`dx`: Print human readable traceback
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
During development I ran into a panic which printed the following error:
```txt
15:52:43 [web] panicked at library/std/src/sys/pal/wasm/../unsupported/time.rs:13:9:
time not implemented on this platform
Stack:
__wbg_get_imports/imports.wbg.__wbg_new_6b2318b8eabfc63e/<@http://192.168.1.249:8080/wasm/seat-route.js:1369:21
logError@http://192.168.1.249:8080/wasm/seat-route.js:151:18
__wbg_get_imports/imports.wbg.__wbg_new_6b2318b8eabfc63e@http://192.168.1.249:8080/wasm/seat-route.js:1368:66
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[17392]:0x2b10c8
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[9820]:0x262601
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[2941]:0x1906c4
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[12970]:0x28b63a
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[3379]:0x1a7db2
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[4694]:0x1e1b50
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[17723]:0x2b20fc
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[13150]:0x28d513
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[13153]:0x28d59c
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[11606]:0x27b7a6
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[986]:0xdf57d
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[3817]:0x1bcbba
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[2559]:0x17884b
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[11059]:0x274663
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[5278]:0x1f7128
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[6069]:0x210b32
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[3800]:0x1bbf4f
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[2567]:0x17908d
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[11304]:0x277999
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[5347]:0x1f96ca
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[334]:0x25e36
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[403]:0x505ed
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[2065]:0x154e97
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[5621]:0x2029b7
@http://192.168.1.249:8080/wasm/seat-route_bg.wasm:wasm-function[12894]:0x28a982
_ZN12wasm_bindgen7convert8closures1_1_6invoke17hef5f8e094bdda1d0E@http://192.168.1.249:8080/wasm/seat-route.js:304:10
real@http://192.168.1.249:8080/wasm/seat-route.js:174:20
```
This only tells where the panic happened but if this location is within library code it is entirely unhelpful.
Instead, `dx` could turn such a traceback to actual `file:function:line-number` on the fly, removing the need to do this manually. (Hopefully, I didn't just miss an option or tool that already does this.)
## Implement Suggestion
I'm not familiar at all with this code base, but one approach could be to:
- Before printing a log message to the user, `dx` could detect whether it contains a traceback.
- If it does, before printing, it should translate any `*.wasm:*:{addr}` into `{file}:{function}:{line-number}` by querying the appropriate `.wasm` file. This could also be a new CLI option (to turn it off).
I'm open to make a PR, but would need some guidance.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.