Add specify exceptions for exceptions handling the vite manifest file #52169
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.
About
This PR changes the handling of errors when trying to access the resources from the manifest file so that more specific exceptions are thrown than just the default
Exception
.The
ViteManifestNotFoundException
is already such a more specific exception and this PR wants to extend this behavior to the other two types of execution that can occur.Backwards compatibility
The existing
ViteManifestNotFoundException
now extends the newViteException
so that catching theViteManifestNotFoundException
still works, as does the newViteException
. A deprecation PHDoc type has been added so thatViteManifestNotFoundException
can be removed in the next major release.Example use case
You want to create a specific error page to indicate to users that they have missed the step to build their frontend, have an incorrect configuration in Docker containers, etc. Without this function, only a general exception is thrown in production (500), but with this PR a specific error page can be created.
Example code to how it could be used