Skip to content

Commit

Permalink
Merge pull request #2836 from WPO-Foundation/type-error-handler
Browse files Browse the repository at this point in the history
feat(error): give an error code for a type error
  • Loading branch information
jefflembeck authored Apr 19, 2023
2 parents e27db20 + ba78f88 commit 0c5c0ec
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion www/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ if (Util::getSetting('cp_auth')) {
exit();
}

if (is_a($e, ForbiddenException::class)) {
if (is_a($e, TypeError::class)) {
error_log($e->getMessage());
$route = "/";
$message = "There was a problem with you account. Please reach out to customer service." .
"Error number: 2000";

$host = Util::getSetting('host');
if (Util::getSetting('php_sessions')) {
unset($_SESSION['client_error']);
$_SESSION['client_error'] = $message;
}
$protocol = "https";
$location = "{$protocol}://{$host}{$route}";
header('Location: ' . $location);
exit();
} elseif (is_a($e, ForbiddenException::class)) {
http_response_code(404);
die();
} elseif (
Expand Down

0 comments on commit 0c5c0ec

Please sign in to comment.