transload error log-ish
This commit is contained in:
parent
b98dd3dd76
commit
50f3d04f0c
2 changed files with 7 additions and 1 deletions
|
@ -214,7 +214,9 @@ abstract class BaseConfig implements Config
|
|||
public function get_string(string $name, ?string $default=null): ?string
|
||||
{
|
||||
$val = $this->get($name, $default);
|
||||
if(!is_string($val) && !is_null($val)) throw new SCoreException("$name is not a string: $val");
|
||||
if (!is_string($val) && !is_null($val)) {
|
||||
throw new SCoreException("$name is not a string: $val");
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,6 +208,10 @@ function transload(string $url, string $mfile): ?array
|
|||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
if ($response === false) {
|
||||
log_warning("core-util", "Failed to transload $url");
|
||||
throw new SCoreException("Failed to fetch $url");
|
||||
}
|
||||
|
||||
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$headers = http_parse_headers(implode("\n", preg_split('/\R/', rtrim(substr($response, 0, $header_size)))));
|
||||
|
|
Reference in a new issue