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
fix(compiler): report not existing files as errors #9690
Conversation
} | ||
return Promise.resolve(compilerHost.readFile(s)); | ||
} | ||
}; |
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.
No test?
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.
We don't have a unit test setup for codegen
yet. Especially for errors. That would require some more thinking that I can't do right now...
LGTM, I suppose, but maybe add a TODO for testing this behavior. |
const xhr: compiler.XHR = { | ||
get: (s: string) => { | ||
if (!compilerHost.fileExists(s)) { | ||
throw new Error(`File not found: ${s}`); |
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.
Can you make the error even less ambiguous by prefixing it with "Compilation failed. Resource file not found: ..."
lgtm otherwise |
Thanks. Changed the error message and added a TODO for adding tests. |
get: (s: string) => { | ||
if (!compilerHost.fileExists(s)) { | ||
// TODO: We should really have a test for error cases like this! | ||
throw new Error(`Compilation failed. Resource file not found: ${s}`); |
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.
I think this is re-caught at https://github.com/angular/angular/blob/master/modules/%40angular/compiler-cli/src/main.ts#L31 with the "compilation failed" message so you maybe only need the "Resource file not found" in the message here? Check what the UI looks like for failures...
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.