Output clean error page on health check route #53528
Merged
+53
−39
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.
Hi,
I've made a couple of tweaks to the application health route.
Rather than depending on Tailwind CDN, I've inlined the CSS.
Exceptions thrown by the DiagnosingHealth event will be captured and a health flag set. If debug mode is enabled, the error will be re-thrown. If debug mode is disabled, the error will be reported and the exception message passed down to the health page.
Based on this, the application health page will then show an error, rather than just outputting a '500 | Server Error' page as it would by default. This still throws a 500 server error so can be picked up by monitoring tools.
I hope you'll give this some consideration! Thanks.