-
Notifications
You must be signed in to change notification settings - Fork 322
Fix double-wrapped compiler errors emitting spurious file:1:1: prefix
#24316
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 all commits
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -354,7 +354,7 @@ func validateWithSchemaAndLocation(frontmatter map[string]any, schemaJSON, conte | |||||
|
|
||||||
| // Format and return the error | ||||||
| formattedErr := console.FormatError(compilerErr) | ||||||
| return errors.New(formattedErr) | ||||||
| return &FormattedParserError{formatted: formattedErr} | ||||||
|
||||||
| return &FormattedParserError{formatted: formattedErr} | |
| return &FormattedParserError{formatted: formattedErr, cause: err} |
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.
NewFormattedParserError always returns a FormattedParserError with a nil
cause, which means external callers (like pkg/workflow) can't preserve the underlying error chain even though FormattedParserError exposes Unwrap(). Consider adding an additional constructor (or extending this one) that accepts an optionalcause errorand sets it, so callers can keep errors.Is/As behavior without reintroducing double-formatting.