Add global error handler with window.onerror