Skip to content

Commit

Permalink
add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vorant94 committed Jun 18, 2024
1 parent 1ec0858 commit 8ae2462
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ import {
import { App } from './App.tsx';
import './index.css';

window.addEventListener('unhandledrejection', function ({ reason }) {
if (import.meta.env.DEV && reason instanceof Error) {
console.error(reason.message);
}
});

window.addEventListener('error', function ({ error }) {
if (import.meta.env.DEV && error instanceof Error) {
console.error(error.message);
}
});

const router = createBrowserRouter([
{
path: '/',
Expand Down

0 comments on commit 8ae2462

Please sign in to comment.