Closed qstokkink closed 2 months ago
It turns out that we can relatively easily forward errors to GitHub. For example:
https://github.com/Tribler/tribler/issues/new?body=Hello+World!%0AI+am+an+issue.
This link creates an issue filled with:
Hello World!
I am an issue
To catch the errors themselves, I think we'll have to wrap all the async http
calls in TriblerService
and IPv8Service
in error handlers.
Getting the actual error out of the response seems like its own can of worms: https://stackoverflow.com/a/66234804
My thinking is that we can then throw
any error that we caught again and then also initiate some sort of user popup (I guess from ) that shows the error and the available options ("search", "report" or "ignore").dialog.tsx
The following works, but getting an alert is proving to be challenging.
try {
return (await this.http.get(`<<URL>>`)).data;
} catch (error) {
console.error(error.response.data.error.message);
// Do something with this
throw error;
}
EDIT: Actually, just setting an interceptor using this.http.interceptors.response.use()
should be simpler.
Alright, I think I'm confident enough to try and resolve this.
You can do some pretty fancy things with this TypeScript stuff:
When we have an uncaught core error, the core responds with an HTTP 500 message to the GUI. However, unless we look at the raw responses coming in (on the GUI side), we won't know of these errors.
We should let a user know that an error has occurred and allow them to forward these hidden stack traces to some error reporting facility (e.g., straight to GitHub issues).