优化错误信息

This commit is contained in:
耗子 2025-06-10 11:09:39 +08:00
parent 8b06cc5400
commit eb950663e7
No known key found for this signature in database
GPG Key ID: C964D7226D045DAA

View File

@ -83,6 +83,13 @@ class CheckUtils
} catch (GuzzleException $e) {
$status = false;
$errmsg = $e->getMessage();
if (preg_match('/^cURL error \d+: /', $errmsg)) {
$errmsg = preg_replace('/^cURL error \d+: /', '', $errmsg);
}
$errmsg = str_replace(' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)', '', $errmsg);
if (strlen($errmsg) > 100) {
$errmsg = substr($errmsg, 0, 97) . '...';
}
}
$usetime = round((microtime(true) - $start) * 1000);