mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
log fopen errors
This commit is contained in:
parent
96c2671fbf
commit
b538cf38d0
1 changed files with 8 additions and 2 deletions
|
|
@ -198,9 +198,15 @@ class NativeShare extends AbstractShare {
|
||||||
* @throws \Icewind\SMB\Exception\InvalidResourceException
|
* @throws \Icewind\SMB\Exception\InvalidResourceException
|
||||||
*/
|
*/
|
||||||
public function get($source, $target) {
|
public function get($source, $target) {
|
||||||
$targetHandle = fopen($target, 'wb');
|
$targetHandle = @fopen($target, 'wb');
|
||||||
if (!$targetHandle) {
|
if (!$targetHandle) {
|
||||||
throw new InvalidResourceException('Failed opening local file "' . $target . '" for writing');
|
$error = error_get_last();
|
||||||
|
if (is_array($error)) {
|
||||||
|
$reason = $error['message'];
|
||||||
|
} else {
|
||||||
|
$reason = 'Unknown error';
|
||||||
|
}
|
||||||
|
throw new InvalidResourceException('Failed opening local file "' . $target . '" for writing: ' . $reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->connect();
|
$this->connect();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue