Error handler and allow video IDs from app share
This commit is contained in:
parent
f18dd802d5
commit
93de0c2d23
9 changed files with 107 additions and 20 deletions
25
helpers/Error.php
Normal file
25
helpers/Error.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
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(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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue