Skip to content

Commit 55649d5

Browse files
committed
comment
1 parent 9a3d1d5 commit 55649d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

resources/lib/UnityHTTPD.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ public static function errorID(?\Throwable $e = null): string
5858
return md5(strval(session_id()) . spl_object_id($e));
5959
}
6060

61+
/*
62+
generates a unique error ID, writes to error log, and then:
63+
if the user is doing an HTTP POST:
64+
registers a message in the user's session and issues a redirect to display that message
65+
else:
66+
prints a message to stdout, sets an HTTP response code, and dies
67+
we can't always do a redirect or else we could risk an infinite loop.
68+
*/
6169
public static function gracefulDie(
6270
string $log_title,
6371
string $log_message,
@@ -79,8 +87,6 @@ public static function gracefulDie(
7987
$user_message_body .= " $suffix";
8088
}
8189
self::errorLog($log_title, $log_message, data: $data, error: $error, errorid: $errorid);
82-
// if the user was doing HTTP POST, then make a pretty error and redirect
83-
// else, a redirect may cause an infinite loop, so fall back on the old ugly error
8490
if ($_SERVER["REQUEST_METHOD"] ?? "" == "POST") {
8591
self::messageError($user_message_title, $user_message_body);
8692
self::redirect();

0 commit comments

Comments
 (0)