Using forked repo and cache engine
This commit is contained in:
parent
a0c60397af
commit
86f6c86c4c
16 changed files with 179 additions and 282 deletions
|
|
@ -2,24 +2,11 @@
|
|||
namespace Helpers;
|
||||
|
||||
class Error {
|
||||
const list = [
|
||||
'api' => [
|
||||
'code' => 500,
|
||||
'message' => 'API unknown error, please check back later'
|
||||
],
|
||||
'latte' => [
|
||||
'code' => 500,
|
||||
'message' => 'Template render crash, please check back later'
|
||||
]
|
||||
];
|
||||
static public function show(object $meta) {
|
||||
$http_code = $meta->http_code;
|
||||
http_response_code($http_code);
|
||||
|
||||
static public function show(string $type) {
|
||||
$keys = array_keys(self::list);
|
||||
if (in_array($type, $keys)) {
|
||||
$error = self::list[$type];
|
||||
http_response_code($error['code']);
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('error'), ['type' => $type, 'error' => $error]);
|
||||
}
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('error'), ['error' => $meta]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue