Add model to track and send errors

Fixed this here and at `window.onerror`