Skip to content

Commit

Permalink
Features/release checklist (#42)
Browse files Browse the repository at this point in the history
* 🎨 Added logs, and improved debugging

* 🎨 Error handling improved
  • Loading branch information
abdheshnayak authored Dec 20, 2023
1 parent 9dc9a5c commit 675c09c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 8 additions & 2 deletions lib/app-setup/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { TopBar } from '~/components/organisms/top-bar';
import styleZenerSelect from '@oshq/react-select/index.css';
import stylesUrl from '~/design-system/index.css';
import rcss from 'react-highlightjs-logs/dist/index.css';
import { isDev } from '../client/helpers/log';

export const links = () => [
{ rel: 'stylesheet', href: stylesUrl },
Expand Down Expand Up @@ -96,9 +97,14 @@ export function ErrorBoundary() {

if (error instanceof Error) {
return (
<ErrorWrapper message={error.message}>
<ErrorWrapper message={error.name}>
<code>
{typeof error.stack === 'string'
{/* eslint-disable-next-line no-nested-ternary */}
{isDev
? typeof error.stack === 'string'
? error.stack
: JSON.stringify(error.stack, null, 2)
: typeof error.stack === 'string'
? error.stack
: JSON.stringify(error.stack, null, 2)}
</code>
Expand Down
10 changes: 4 additions & 6 deletions lib/client/helpers/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const PostToHook = (message: string) => {
return {};
};

const isDev = getNodeEnv() === 'development';
export const isDev = getNodeEnv() === 'development';

const logger = {
time: isDev ? console.time : () => {},
Expand Down Expand Up @@ -98,11 +98,9 @@ const logger = {
console.trace(args);
}

// if (isDev && typeof window === 'undefined') {
// serverError(args);
// }

serverError(args);
if (isDev && typeof window === 'undefined') {
serverError(args);
}
},
};

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import logger from '../client/helpers/log';

export const handleError = (e: unknown): void => {
const err = e as Error;
logger.error(e);
toast.error(err.message);
logger.error(e);
};

export const parseError = (e: unknown): Error => {
Expand Down

0 comments on commit 675c09c

Please sign in to comment.