History

Add frontend error fallback

Rhys Sullivan committed 6 months ago

Commit 64aa2ae1 parent 2fdd0001 file · +35 −1Browse files

Unified · Split

apps/cloud/src/routes/__root.tsx+35−1
@@ -167,6 +167,40 @@ function ShellSkeleton() { · 166 unmodified lines
167 );167 );
168}168}
169 169
170function ShellErrorFallback() {
171 const supportLinks = [
172 { label: "Discord", href: "https://discord.gg/eF29HBHwM6" },
173 { label: "GitHub Issues", href: "https://github.com/RhysSullivan/executor/issues" },
174 { label: "Slack", href: "mailto:rhys@executor.sh?subject=Executor%20Slack%20invite" },
175 { label: "Email", href: "mailto:rhys@executor.sh?subject=Executor%20support" },
176 ] as const;
177
178 return (
179 <main className="flex min-h-screen items-center justify-center bg-background px-6 py-10">
180 <section className="w-full max-w-md text-center">
181 <div className="mx-auto mb-5 flex size-11 items-center justify-center rounded-full border border-border bg-muted">
182 <span className="text-lg font-semibold text-muted-foreground">!</span>
183 </div>
184 <h1 className="text-xl font-semibold text-foreground">Something went wrong</h1>
185 <p className="mt-2 text-sm leading-6 text-muted-foreground">
186 We&apos;ve tracked it. Give refreshing a try, and get in touch if support is needed.
187 </p>
188 <div className="mt-6 flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-sm">
189 {supportLinks.map((link) => (
190 <a
191 key={link.label}
192 href={link.href}
193 className="font-medium text-foreground underline-offset-4 hover:underline"
194 >
195 {link.label}
196 </a>
197 ))}
198 </div>
199 </section>
200 </main>
201 );
202}
203
170function AuthGate() {204function AuthGate() {
171 const auth = useAuth();205 const auth = useAuth();
172 206
@@ -184,7 +218,7 @@ function AuthGate() { · 11 unmodified lines
184 218
185 return (219 return (
186 <AutumnProvider pathPrefix="/api/autumn">220 <AutumnProvider pathPrefix="/api/autumn">
187 <Sentry.ErrorBoundary fallback={<ShellSkeleton />} showDialog={false}>221 <Sentry.ErrorBoundary fallback={<ShellErrorFallback />} showDialog={false}>
188 <ExecutorProvider fallback={<ShellSkeleton />} onHandledError={captureFrontendError}>222 <ExecutorProvider fallback={<ShellSkeleton />} onHandledError={captureFrontendError}>
189 <ExecutorPluginsProvider plugins={clientPlugins}>223 <ExecutorPluginsProvider plugins={clientPlugins}>
190 <Shell />224 <Shell />