-
Notifications
You must be signed in to change notification settings - Fork 130
Proper error stack propogating #280
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
Changes from 5 commits
b7f6c5e
5beca82
45cbc3b
891a85d
190efed
e6e749e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/world-local": patch | ||
| --- | ||
|
|
||
| Support for structured errors |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/web-shared": patch | ||
| --- | ||
|
|
||
| Support structured error rendering |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/core": patch | ||
| --- | ||
|
|
||
| Implement the world's structured error interface |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/world-postgres": patch | ||
| --- | ||
|
|
||
| Support structured errors for steps and runs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/errors": patch | ||
| --- | ||
|
|
||
| Wire through world's structured errors in WorkflowRunFailedError |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/world": patch | ||
| --- | ||
|
|
||
| Add error stack propogation to steps and runs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@workflow/world-vercel": patch | ||
| --- | ||
|
|
||
| Support structured errors for steps and runs |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -53,7 +53,6 @@ const attributeOrder: AttributeKey[] = [ | |||||||||||||||||||||||||||||||||
| 'completedAt', | ||||||||||||||||||||||||||||||||||
| 'retryAfter', | ||||||||||||||||||||||||||||||||||
| 'error', | ||||||||||||||||||||||||||||||||||
| 'errorCode', | ||||||||||||||||||||||||||||||||||
| 'metadata', | ||||||||||||||||||||||||||||||||||
| 'eventData', | ||||||||||||||||||||||||||||||||||
| 'input', | ||||||||||||||||||||||||||||||||||
|
|
@@ -123,9 +122,68 @@ const attributeToDisplayFn: Record< | |||||||||||||||||||||||||||||||||
| return <DetailCard summary="Output">{JsonBlock(value)}</DetailCard>; | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| error: (value: unknown) => { | ||||||||||||||||||||||||||||||||||
| return <DetailCard summary="Error">{JsonBlock(value)}</DetailCard>; | ||||||||||||||||||||||||||||||||||
| // Handle structured error format | ||||||||||||||||||||||||||||||||||
| if (value && typeof value === 'object' && 'message' in value) { | ||||||||||||||||||||||||||||||||||
| const error = value as { | ||||||||||||||||||||||||||||||||||
| message: string; | ||||||||||||||||||||||||||||||||||
| stack?: string; | ||||||||||||||||||||||||||||||||||
| code?: string; | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||
| <DetailCard summary="Error"> | ||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-2"> | ||||||||||||||||||||||||||||||||||
| {/* Show code if it exists */} | ||||||||||||||||||||||||||||||||||
| {error.code && ( | ||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||
| <span | ||||||||||||||||||||||||||||||||||
| className="text-copy-12 font-medium" | ||||||||||||||||||||||||||||||||||
| style={{ color: 'var(--ds-gray-700)' }} | ||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||
| Error Code:{' '} | ||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||
| <code | ||||||||||||||||||||||||||||||||||
| className="text-copy-12" | ||||||||||||||||||||||||||||||||||
| style={{ color: 'var(--ds-gray-1000)' }} | ||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||
| {error.code} | ||||||||||||||||||||||||||||||||||
| </code> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||
| {/* Show stack if available, otherwise just the message */} | ||||||||||||||||||||||||||||||||||
| <pre | ||||||||||||||||||||||||||||||||||
| className="text-copy-12 overflow-x-auto rounded-md border p-4" | ||||||||||||||||||||||||||||||||||
| style={{ | ||||||||||||||||||||||||||||||||||
| borderColor: 'var(--ds-gray-300)', | ||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not relevant to PR, but reminder to myself that I gotta fix these variable names to be tw classes |
||||||||||||||||||||||||||||||||||
| backgroundColor: 'var(--ds-gray-100)', | ||||||||||||||||||||||||||||||||||
| color: 'var(--ds-gray-1000)', | ||||||||||||||||||||||||||||||||||
| whiteSpace: 'pre-wrap', | ||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||
| <code>{error.stack || error.message}</code> | ||||||||||||||||||||||||||||||||||
| </pre> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </DetailCard> | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Fallback for plain string errors | ||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||
| <DetailCard summary="Error"> | ||||||||||||||||||||||||||||||||||
| <pre | ||||||||||||||||||||||||||||||||||
| className="text-copy-12 overflow-x-auto rounded-md border p-4" | ||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. De-dupe with styling above by extracting component
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I'll fix this in a follow up PR. the PR stack has gotten really messy with this git butler thing and everythings in a bad state so I just wanna get this merged in and fix the rest of your comments in a separate PR completely
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm gonna merge this if the current tests pass and then open a fix PR directly on main with more stuff |
||||||||||||||||||||||||||||||||||
| style={{ | ||||||||||||||||||||||||||||||||||
| borderColor: 'var(--ds-gray-300)', | ||||||||||||||||||||||||||||||||||
| backgroundColor: 'var(--ds-gray-100)', | ||||||||||||||||||||||||||||||||||
| color: 'var(--ds-gray-1000)', | ||||||||||||||||||||||||||||||||||
| whiteSpace: 'pre-wrap', | ||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||
| <code>{String(value)}</code> | ||||||||||||||||||||||||||||||||||
| </pre> | ||||||||||||||||||||||||||||||||||
| </DetailCard> | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+171
to
+185
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The error display function uses View DetailsAnalysisError attribute displays
|
||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| errorCode: JsonBlock, | ||||||||||||||||||||||||||||||||||
| eventData: (value: unknown) => { | ||||||||||||||||||||||||||||||||||
| return <DetailCard summary="Event Data">{JsonBlock(value)}</DetailCard>; | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
|
|
@@ -135,7 +193,6 @@ const resolvableAttributes = [ | |||||||||||||||||||||||||||||||||
| 'input', | ||||||||||||||||||||||||||||||||||
| 'output', | ||||||||||||||||||||||||||||||||||
| 'error', | ||||||||||||||||||||||||||||||||||
| 'errorCode', | ||||||||||||||||||||||||||||||||||
| 'metadata', | ||||||||||||||||||||||||||||||||||
| 'eventData', | ||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.