Skip to content

Commit a9928be

Browse files
committed
pretty errors can have magic dashboard links
1 parent 13faa69 commit a9928be

File tree

2 files changed

+44
-11
lines changed
  • apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam
  • packages/core/src/v3

2 files changed

+44
-11
lines changed

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam/route.tsx

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { CheckIcon, ClockIcon, CloudArrowDownIcon, QueueListIcon } from "@heroicons/react/20/solid";
1+
import {
2+
CheckIcon,
3+
ClockIcon,
4+
CloudArrowDownIcon,
5+
EnvelopeIcon,
6+
QueueListIcon,
7+
} from "@heroicons/react/20/solid";
28
import { Link } from "@remix-run/react";
39
import { LoaderFunctionArgs } from "@remix-run/server-runtime";
410
import {
@@ -13,6 +19,7 @@ import { typedjson, useTypedFetcher } from "remix-typedjson";
1319
import { ExitIcon } from "~/assets/icons/ExitIcon";
1420
import { CodeBlock } from "~/components/code/CodeBlock";
1521
import { EnvironmentLabel } from "~/components/environments/EnvironmentLabel";
22+
import { Feedback } from "~/components/Feedback";
1623
import { Button, LinkButton } from "~/components/primitives/Buttons";
1724
import { Callout } from "~/components/primitives/Callout";
1825
import { DateTime, DateTimeAccurate } from "~/components/primitives/DateTime";
@@ -963,11 +970,26 @@ function RunError({ error }: { error: TaskRunError }) {
963970
<div className="flex flex-col gap-2 rounded-sm border border-rose-500/50 px-3 pb-3 pt-2">
964971
<Header3 className="text-rose-500">{name}</Header3>
965972
{enhancedError.message && <Callout variant="error">{enhancedError.message}</Callout>}
966-
{enhancedError.link && (
967-
<Callout variant="docs" to={enhancedError.link.href}>
968-
{enhancedError.link.name}
969-
</Callout>
970-
)}
973+
{enhancedError.link &&
974+
(enhancedError.link.magic === "CONTACT_FORM" ? (
975+
<Feedback
976+
button={
977+
<Button
978+
variant="tertiary/medium"
979+
LeadingIcon={EnvelopeIcon}
980+
leadingIconClassName="text-blue-400"
981+
fullWidth
982+
textAlignLeft
983+
>
984+
{enhancedError.link.name}
985+
</Button>
986+
}
987+
/>
988+
) : (
989+
<Callout variant="docs" to={enhancedError.link.href}>
990+
{enhancedError.link.name}
991+
</Callout>
992+
))}
971993
{enhancedError.stackTrace && (
972994
<CodeBlock
973995
showCopyButton={false}

packages/core/src/v3/errors.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,22 @@ export class GracefulExitTimeoutError extends Error {
312312
}
313313
}
314314

315+
type ErrorLink = {
316+
name: string;
317+
href: string;
318+
magic?: "CONTACT_FORM";
319+
};
320+
321+
type EnhanceError<T extends TaskRunError | ExceptionEventProperties> = T & { link?: ErrorLink };
322+
315323
const prettyInternalErrors: Partial<
316-
Record<TaskRunInternalError["code"], { message: string; link?: { name: string; href: string } }>
324+
Record<
325+
TaskRunInternalError["code"],
326+
{
327+
message: string;
328+
link?: ErrorLink;
329+
}
330+
>
317331
> = {
318332
TASK_PROCESS_OOM_KILLED: {
319333
message:
@@ -337,14 +351,11 @@ const prettyInternalErrors: Partial<
337351
link: {
338352
name: "Contact us",
339353
href: links.site.contact,
354+
magic: "CONTACT_FORM",
340355
},
341356
},
342357
};
343358

344-
type EnhanceError<T extends TaskRunError | ExceptionEventProperties> = T & {
345-
link?: { name: string; href: string };
346-
};
347-
348359
export function taskRunErrorEnhancer(error: TaskRunError): EnhanceError<TaskRunError> {
349360
switch (error.type) {
350361
case "BUILT_IN_ERROR": {

0 commit comments

Comments
 (0)