2022-01-11 13:25:30 -05:00
|
|
|
<?php
|
2022-01-30 18:02:52 -05:00
|
|
|
namespace App\Helpers;
|
2022-01-11 13:25:30 -05:00
|
|
|
|
2022-02-05 18:58:30 -05:00
|
|
|
use App\Models\ErrorTemplate;
|
2022-05-24 08:10:41 -04:00
|
|
|
use TikScraper\Models\Meta;
|
2022-02-05 18:58:30 -05:00
|
|
|
|
2022-01-28 09:54:09 -05:00
|
|
|
class ErrorHandler {
|
2022-09-03 08:01:03 -04:00
|
|
|
static public function showMeta(Meta $meta) {
|
2022-01-28 09:54:09 -05:00
|
|
|
http_response_code($meta->http_code);
|
2022-03-29 13:30:31 -04:00
|
|
|
$latte = Wrappers::latte();
|
2022-09-03 08:01:03 -04:00
|
|
|
$latte->render(Misc::getView('error'), new ErrorTemplate($meta->http_code, $meta->tiktok_msg, $meta->tiktok_code));
|
|
|
|
}
|
|
|
|
|
|
|
|
static public function showText(int $code, string $msg) {
|
|
|
|
http_response_code($code);
|
|
|
|
$latte = Wrappers::latte();
|
|
|
|
$latte->render(Misc::getView('error'), new ErrorTemplate($code, $msg));
|
2022-01-11 13:25:30 -05:00
|
|
|
}
|
|
|
|
}
|