-
Notifications
You must be signed in to change notification settings - Fork 2
feat: error toasts #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: error toasts #368
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
| import { ipcRenderer } from "electron"; | ||
| import "electron-log/preload"; | ||
|
|
||
| // No TRPC available, so just use IPC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(yet). this happens before we initialise TRPC
| </Text> | ||
| <Text size="2" color="gray" align="center"> | ||
| {error.message} | ||
| </Text> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's render stack here
|
|
||
| const devErrorToastsEnabled = | ||
| IS_DEV && import.meta.env.VITE_DEV_ERROR_TOASTS !== "false"; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this consistent with how we set dev in main? I believe not.
| error: (message: string, ...args: unknown[]) => log.error(message, ...args), | ||
| debug: (message: string, ...args: unknown[]) => log.debug(message, ...args), | ||
| const devErrorToastsEnabled = | ||
| IS_DEV && import.meta.env.VITE_DEV_ERROR_TOASTS !== "false"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this value shouldnt have to be determined in 3 different spots in the code, export to util
| interface BaseLog { | ||
| info: LogFn; | ||
| warn: LogFn; | ||
| error: LogFn; | ||
| debug: LogFn; | ||
| scope: (name: string) => { | ||
| info: LogFn; | ||
| warn: LogFn; | ||
| error: LogFn; | ||
| debug: LogFn; | ||
| }; | ||
| } | ||
|
|
||
| export interface ScopedLogger { | ||
| info: LogFn; | ||
| warn: LogFn; | ||
| error: LogFn; | ||
| debug: LogFn; | ||
| scope: (name: string) => ScopedLogger; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this simpler?
apps/array/vite.main.config.mts
Outdated
| } | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| const monorepoRoot = path.resolve(__dirname, "../.."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using this for anything?
jonathanlab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
This makes handling errors and warnings easier for our setup.
In development, we now render toasts for uncaught exceptions and unhandled rejections in both renderer and main, preload errors, and trpc query/mutation errors.
We can now also send any toast to the user from the main process via the
user-notificationsservice.I added a react error boundary, not sure if we want to keep this around.