diff --git a/apps/renderer/src/lib/error-parser.ts b/apps/renderer/src/lib/error-parser.ts index 1990fa2e1..50ff42d71 100644 --- a/apps/renderer/src/lib/error-parser.ts +++ b/apps/renderer/src/lib/error-parser.ts @@ -7,6 +7,8 @@ import { toast } from "sonner" import { CopyButton } from "~/components/ui/code-highlighter" import { Markdown } from "~/components/ui/markdown/Markdown" +import { isDev } from "~/constants" +import { DebugRegistry } from "~/modules/debug/registry" export const getFetchErrorMessage = (error: Error) => { if (error instanceof FetchError) { @@ -62,7 +64,7 @@ export const toastFetchError = ( ..._toastOptions, classNames: { toast: "items-start bg-theme-background", - title: tw`-mt-0.5`, // to align with the icon (actually cut the top space from line-height) + content: "w-full", ..._toastOptions.classNames, }, @@ -95,3 +97,19 @@ export const toastFetchError = ( }) } } +if (isDev) { + DebugRegistry.add("Simulate request error", () => { + createErrorToaster( + "Simulated request error", + {}, + )({ + response: { + _data: JSON.stringify({ + code: 1000, + message: "Simulated request error", + reason: "Simulated reason", + }), + }, + } as any) + }) +} diff --git a/apps/renderer/src/modules/app/EnvironmentIndicator.tsx b/apps/renderer/src/modules/app/EnvironmentIndicator.tsx index 981e5fef6..c4f670a3d 100644 --- a/apps/renderer/src/modules/app/EnvironmentIndicator.tsx +++ b/apps/renderer/src/modules/app/EnvironmentIndicator.tsx @@ -35,8 +35,8 @@ export const EnvironmentIndicator = () => {