-
Notifications
You must be signed in to change notification settings - Fork 11
setup shutdown function #297
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
Conversation
uncaught exception1 file changed, 2 insertions(+)
webroot/admin/user-mgmt.php | 2 ++
modified webroot/admin/user-mgmt.php
@@ -85,3 +85,5 @@ require $LOC_HEADER;
<?php
require $LOC_FOOTER;
+
+throw new RuntimeError("deleteme");Screen.Recording.2025-09-10.at.8.53.47.AM.movcaught exception1 file changed, 6 insertions(+)
resources/init.php | 6 ++++++
modified resources/init.php
@@ -141,3 +141,9 @@ $LOC_HEADER = __DIR__ . "/templates/header.php";
$LOC_FOOTER = __DIR__ . "/templates/footer.php";
register_shutdown_function(array("UnityWebPortal\lib\UnitySite", "shutdown"));
+
+try {
+ throw new RuntimeException("deleteme");
+} catch(RuntimeException) {
+ echo "caught";
+}Screen.Recording.2025-09-10.at.9.10.04.AM.movredirectScreen.Recording.2025-09-10.at.9.16.48.AM.mov |
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.
Pull Request Overview
This PR implements a generic error handling mechanism to replace the white screen of death with user-friendly error messages that include unique error identifiers for debugging purposes.
- Adds a shutdown function to catch fatal errors and display a generic error message
- Updates error handling methods to clear last error to prevent interference
- Simplifies SSO error handling by removing explicit try-catch and letting the shutdown function handle errors
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| resources/lib/UnitySite.php | Adds shutdown function for error handling and clears errors in badRequest/forbidden methods |
| resources/init.php | Registers the shutdown function and removes explicit SSO error handling |
| test/functional/InvalidEPPNTest.php | Updates test to expect SSOException instead of PhpUnitNoDieException |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
resources/lib/UnitySite.php
Outdated
| self::errorLog("internal server error", json_encode($e)); | ||
| echo " | ||
| <h1>An internal server error has occurred.</h1> | ||
| <p>Please notify a Unity admin. Error ID: $errorid.</p> |
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.
Why not put the support email here like in the old message?
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.
because UnityConfig isn't exposed inside UnitySite
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.
Any reason it can't be?
6a7f164 to
8312ea2
Compare
ffc509b to
0192835
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.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.



This replaces the white screen of death with a generic error message with a unique error identifier. #292