fix(@angular/build): improve error message when an unhandled exception occurs during prerendering#28215
Merged
alan-agius4 merged 1 commit intoangular:mainfrom Aug 15, 2024
Merged
Conversation
alan-agius4
commented
Aug 15, 2024
| const { routes: extractedRoutes, warnings }: RoutersExtractorWorkerResult = await renderWorker | ||
| .run({}) | ||
| .catch((err) => { | ||
| errors.push(`An error occurred while extracting routes.\n\n${err.stack}`); |
Collaborator
Author
There was a problem hiding this comment.
In this case, I opted to display the stack trace instead of just the error message. This can help users identify the exact part of their application that is causing the error.
Alternatively, I can modify this behavior to only display the stack trace when verbose mode is enabled.
…n occurs during prerendering
This change enhances the error messaging when an unhandled exception occurs during the prerendering process. The updated error message provides more context and clarity.
**Previous Behavior**
```
ng b
An unhandled exception occurred: Some error!!!
See "/tmp/ng-S2ABKF/angular-errors.log" for further details.
```
**Updated Behavior:**
```
ng b
Browser bundles
Initial chunk files | Names | Raw size | Estimated transfer size
main-AFPIPGGK.js | main | 218.00 kB | 59.48 kB
polyfills-Z2GOM3BN.js | polyfills | 35.82 kB | 11.80 kB
styles-5INURTSO.css | styles | 0 bytes | 0 bytes
| Initial total | 253.82 kB | 71.28 kB
Server bundles
Initial chunk files | Names | Raw size
server.mjs | server | 1.11 MB |
chunk-HZL5H5M5.mjs | - | 526.77 kB |
polyfills.server.mjs | polyfills.server | 269.91 kB |
chunk-GFWAPST7.mjs | - | 19.16 kB |
chunk-5XUXGTUW.mjs | - | 2.55 kB |
render-utils.server.mjs | render-utils.server | 1.46 kB |
main.server.mjs | main.server | 149 bytes |
Lazy chunk files | Names | Raw size
chunk-7YC4RJ5P.mjs | xhr2 | 12.08 kB |
Prerendered 1 static route.
Application bundle generation failed. [4.923 seconds]
✘ [ERROR] An error occurred while prerendering route '/'.
Error: Some error!!!
at render (node_modules/@angular/build/src/utils/server-rendering/render-worker.js:20:20)
at /angular-cli/abc/node_modules/piscina/dist/worker.js:146:32
```
Closes angular#28212
691019e to
5f66ff4
Compare
clydin
approved these changes
Aug 15, 2024
Collaborator
Author
|
The changes were merged into the following branches: main, 18.2.x |
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change enhances the error messaging when an unhandled exception occurs during the prerendering process. The updated error message provides more context and clarity.
Previous Behavior
Updated Behavior:
Closes #28212