I am using angular and I would like to implement a bug report function in my app. For that I want to send the content of the browsers console for debugging. But how can I reach out to it.
Not every error is thrown manually with console.log(… so that I could save it at the same time, some errors are thrown from angular itself or thrown Exceptions from httpservice.
Is it possible to access the content of the frontend console?
Thank you.
Advertisement
Answer
It’s a better approach, if you do not rely on the console. It’s up to you, but I say that letting an error reaching the console is not a best practice. You can catch the errors before they arrive on the console anyway.
- For HTTPClient errors, you can use an error Iterceptor
- For Angular “code” errors, I recommend using a Global Error Handler