mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-24 09:42:43 +01:00
Improve error messages in FileSystem::fetch()
This commit is contained in:
parent
de0d635917
commit
45e9a33f59
@ -374,7 +374,12 @@ class FileSystem
|
||||
}
|
||||
$data = @file_get_contents($source, false, $context);
|
||||
if ($data === false) {
|
||||
throw new RuntimeException('Cannot fetch ' . $source);
|
||||
$message = error_get_last()['message'] ?? '';
|
||||
// Stream errors are in the form %s(%s):%s, we only need the trailing part
|
||||
if (preg_match('/^.*\(.*\)(:.*)/', $message, $matches)) {
|
||||
$message = $matches[1];
|
||||
}
|
||||
throw new RuntimeException('Cannot fetch ' . $source . $message);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user