Fixed error in render_info macro.
This commit is contained in:
parent
33bf839689
commit
88b3acf08e
1 changed files with 8 additions and 14 deletions
|
@ -103,12 +103,10 @@ function render_error(int $code, string $template = 'errors.%d'): string {
|
|||
function render_info(?string $message, int $httpCode, string $template = 'errors.%d'): string {
|
||||
http_response_code($httpCode);
|
||||
|
||||
try {
|
||||
\Misuzu\Template::set('http_code', $httpCode);
|
||||
|
||||
if(mb_strlen($message)) {
|
||||
if(!empty($message))
|
||||
\Misuzu\Template::set('message', $message);
|
||||
}
|
||||
|
||||
$template = sprintf($template, $httpCode);
|
||||
|
||||
|
@ -117,10 +115,6 @@ function render_info(?string $message, int $httpCode, string $template = 'errors
|
|||
}*/
|
||||
|
||||
return \Misuzu\Template::renderRaw(sprintf($template, $httpCode));
|
||||
} catch(Exception $ex) {
|
||||
echo $ex->getMessage();
|
||||
return $message ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
function render_info_or_json(bool $json, string $message, int $httpCode = 200, string $template = 'errors.%d'): string {
|
||||
|
|
Loading…
Reference in a new issue