Show debug info when TikTok gives error
This commit is contained in:
parent
3ba64be202
commit
a3b4143ab1
|
@ -7,7 +7,7 @@ use TikScraper\Models\Meta;
|
||||||
class ErrorHandler {
|
class ErrorHandler {
|
||||||
public static function showMeta(Meta $meta) {
|
public static function showMeta(Meta $meta) {
|
||||||
http_response_code($meta->httpCode);
|
http_response_code($meta->httpCode);
|
||||||
Wrappers::latte('error', new ErrorTemplate($meta->httpCode, $meta->proxitokMsg, $meta->proxitokCode));
|
Wrappers::latte('error', new ErrorTemplate($meta->httpCode, $meta->proxitokMsg, $meta->proxitokCode, $meta->response));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function showText(int $code, string $msg) {
|
public static function showText(int $code, string $msg) {
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
use TikScraper\Models\Response;
|
||||||
|
|
||||||
class ErrorTemplate extends BaseTemplate {
|
class ErrorTemplate extends BaseTemplate {
|
||||||
public int $http_code = 502;
|
public int $http_code = 502;
|
||||||
public ?int $tiktok_code = -1;
|
public ?int $tiktok_code = -1;
|
||||||
public string $msg = '';
|
public string $msg = '';
|
||||||
|
|
||||||
|
public ?Response $response = null;
|
||||||
|
|
||||||
function __construct(int $http_code, string $msg, ?int $tiktok_code = null) {
|
|
||||||
|
function __construct(int $http_code, string $msg, ?int $tiktok_code = null, ?Response $response) {
|
||||||
parent::__construct('Error');
|
parent::__construct('Error');
|
||||||
$this->http_code = $http_code;
|
$this->http_code = $http_code;
|
||||||
$this->msg = $msg;
|
$this->msg = $msg;
|
||||||
$this->tiktok_code = $tiktok_code;
|
$this->tiktok_code = $tiktok_code;
|
||||||
|
$this->response = $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "pablouser1/proxitok",
|
"name": "pablouser1/proxitok",
|
||||||
"description": "An alternative frontend for TikTok",
|
"description": "An alternative frontend for TikTok",
|
||||||
"version": "2.4.9.3",
|
"version": "2.4.9.4",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
14
composer.lock
generated
14
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "4936009a1822a0fc75b73211a28827cb",
|
"content-hash": "e32037e3931913dc8d292e7dadde275f",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bramus/router",
|
"name": "bramus/router",
|
||||||
|
@ -587,16 +587,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pablouser1/tikscraper",
|
"name": "pablouser1/tikscraper",
|
||||||
"version": "v2.4.0.2",
|
"version": "v2.4.0.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
||||||
"reference": "eb12cc62176a58f1952983c34275453c8a4bcc46"
|
"reference": "a64c912b0db72ffa85e3a2e3e6c375f1ae86aedd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/eb12cc62176a58f1952983c34275453c8a4bcc46",
|
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/a64c912b0db72ffa85e3a2e3e6c375f1ae86aedd",
|
||||||
"reference": "eb12cc62176a58f1952983c34275453c8a4bcc46",
|
"reference": "a64c912b0db72ffa85e3a2e3e6c375f1ae86aedd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -630,9 +630,9 @@
|
||||||
"description": "Get data from TikTok API",
|
"description": "Get data from TikTok API",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
|
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
|
||||||
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.4.0.2"
|
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.4.0.3"
|
||||||
},
|
},
|
||||||
"time": "2023-09-29T11:50:04+00:00"
|
"time": "2023-10-06T22:15:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "php-webdriver/webdriver",
|
"name": "php-webdriver/webdriver",
|
||||||
|
|
|
@ -14,5 +14,11 @@
|
||||||
{else}
|
{else}
|
||||||
<p>{$msg}</p>
|
<p>{$msg}</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
{if isset($response)}
|
||||||
|
<details>
|
||||||
|
<summary>Show debug info</summary>
|
||||||
|
<pre style="max-height: 60vh;">{json_encode($response, JSON_PRETTY_PRINT)}</pre>
|
||||||
|
</details>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
Loading…
Reference in a new issue