Show a toast when a Javascript error occurs

How?

Why?

What does it look like when an error occurs?

Can I improve this?

There must be a better way

Why can't I npm install this?