-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(core): create structured project graph errors with all plugin er… #22404
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
8e4091c
to
712dd10
Compare
712dd10
to
05be1f5
Compare
05be1f5
to
fbb33a8
Compare
fbb33a8
to
a731b34
Compare
a731b34
to
76516e6
Compare
76516e6
to
d115b78
Compare
d115b78
to
b390caf
Compare
b390caf
to
4dd3c73
Compare
8527813
to
6dad954
Compare
6dad954
to
0738330
Compare
0738330
to
aaaf040
Compare
c46dc87
to
b07d5bd
Compare
b07d5bd
to
469f2ad
Compare
469f2ad
to
eea8524
Compare
eea8524
to
ee1e255
Compare
ee1e255
to
a986400
Compare
a986400
to
db3f779
Compare
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.
Few comments
packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts
Outdated
Show resolved
Hide resolved
export class ProcessDependenciesError extends Error { | ||
constructor(public readonly pluginName: string, { cause }) { | ||
super( | ||
`The "${pluginName}" plugin threw an error while creating dependencies:`, | ||
{ | ||
cause, | ||
} | ||
); | ||
this.name = this.constructor.name; | ||
this.stack = `${this.message}\n ${cause.stack.split('\n').join('\n ')}`; | ||
} | ||
} | ||
|
||
export class ProcessProjectGraphError extends Error { | ||
constructor(public readonly pluginName: string, { cause }) { | ||
super( | ||
`The "${pluginName}" plugin threw an error while processing the project graph:`, | ||
{ | ||
cause, | ||
} | ||
); | ||
this.name = this.constructor.name; | ||
this.stack = `${this.message}\n ${cause.stack.split('\n').join('\n ')}`; | ||
} | ||
} | ||
|
||
export class CreateDependenciesError extends Error { | ||
constructor( | ||
public readonly errors: Array< | ||
ProcessDependenciesError | ProcessProjectGraphError | ||
>, | ||
public readonly partialProjectGraph: ProjectGraph | ||
) { | ||
super('Failed to create dependencies. See above for errors'); | ||
this.name = this.constructor.name; | ||
} | ||
} |
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.
followup: move to be near CreateNodesError, consider devkit export
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
…rors
Current Behavior
When an error is thrown while creating a part of the project graph, the rest of the project graph is not created. The underlying error is thrown immediately.
Expected Behavior
When an error is thrown when creating a part of the project graph, the error is stored and thrown later. These errors are all exposed via the
ProjectGraphError
class which will contain a few things:This error is still a legitimate error but in some cases it could be handled.
Most processes likely need the full project graph so the error will be printed out. The full stacktraces are hidden unless
--verbose
is passed.For example, in the graph app such as the graph or the project details view, we can still show the partial graph or the partial project.
Related Issue(s)
Fixes #