unyt-org / uix

The UIX Framework
https://uix.unyt.org
MIT License
54 stars 3 forks source link

Implement Advanced Error Presentations #150

Closed asbng closed 2 months ago

asbng commented 3 months ago

This Pull Request implements first measures to advance with #144.

The changes improve error presentation and readability for UIX users. Common errors and possible solutions can be represented by throwing KnownErrors as defined in src/types/errors.ts.

jonasstrehle commented 3 months ago

We should consider that that might collide with "unhandledrejection" https://github.com/unyt-org/datex-core-js-legacy/blob/0e3224c02692cd9f10e84e6b4342e2aa9a146dc9/init.ts#L22

asbng commented 3 months ago

Indeed, this will definitely be problematic as the current implementation in this PR exits Deno immediately whereas the unhandledrejection handler in datex-core-legacy initiates asynchronous work. We might want to somehow integrate / unify the solutions with each other.

Also, https://github.com/unyt-org/datex-core-js-legacy/blob/0e3224c02692cd9f10e84e6b4342e2aa9a146dc9/init.ts#L26 should not be executed when the UIX CLI encounters an error as it performs error presentation on its own.

benStre commented 3 months ago

They added a fix for the websocket exception in May (https://github.com/denoland/deno/pull/21849), not sure if there are any other promise rejections that cannot be handled, but I think we can remove the unhandledrejection handler for now.

asbng commented 3 months ago

I hooked up error reporting via sendReport() from datex-core-legacy. This will only work correctly, however, once unyt-org/datex-core-js-legacy#107 is addressed.