diff options
| author | winter | 2024-12-07 21:44:42 +0000 |
|---|---|---|
| committer | winter | 2024-12-07 21:44:42 +0000 |
| commit | a84232811dadccf7047424f27340a7f9847bedff (patch) | |
| tree | a6a0823c8b9485b6a5b60ea7ae854f9511a6ae1e /WpfTest/HttpResponseStatus/InternalServerError.php | |
| parent | e1ad307b531c27ec6bfaf8b4d018991b0d4a78f3 (diff) | |
many many changes but actors are loaded from db now
Diffstat (limited to 'WpfTest/HttpResponseStatus/InternalServerError.php')
| -rw-r--r-- | WpfTest/HttpResponseStatus/InternalServerError.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/WpfTest/HttpResponseStatus/InternalServerError.php b/WpfTest/HttpResponseStatus/InternalServerError.php new file mode 100644 index 0000000..11b67f3 --- /dev/null +++ b/WpfTest/HttpResponseStatus/InternalServerError.php @@ -0,0 +1,23 @@ +<?php +namespace WpfTest\HttpResponseStatus; + +use WpfTest\GlobalConfig; +use WpfTest\HttpResponseStatus; + +class InternalServerError extends \Exception implements HttpResponseStatus { + public function __construct(\Throwable $reason, ?string $context = null) { + $this->message = $reason::class . ': ' . $reason->getMessage(); + if (isset($context)) { + $this->message .= " [$context]"; + } + if (GlobalConfig::getInstance()->shouldReportTraces()) { + $this->message .= "\n" . $reason->getTraceAsString(); + } + } + public function httpCode(): int { + return 500; + } + public function httpReason(): string { + return "Internal Server Error"; + } +}
\ No newline at end of file |
