Skip to content

Commit

Permalink
Merge pull request #10090 from nextcloud/smb-log-connection-errors
Browse files Browse the repository at this point in the history
Improved logging of smb connection errors
  • Loading branch information
rullzer authored Jul 3, 2018
2 parents e97191e + 2708942 commit df84c3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/ObjectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function getNodeForPath($path) {
throw new StorageNotAvailableException();
}
} catch (StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available');
throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available', 0, $e);
} catch (StorageInvalidException $e) {
throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
} catch (LockedException $e) {
Expand Down
8 changes: 8 additions & 0 deletions apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ protected function getFileInfo($path) {
}
return $this->statCache[$path];
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while getting file info']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand All @@ -180,6 +181,7 @@ protected function getFolderContents($path) {
}
});
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while getting folder content']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand Down Expand Up @@ -304,6 +306,7 @@ public function unlink($path) {
} catch (ForbiddenException $e) {
return false;
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while deleting file']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand Down Expand Up @@ -388,6 +391,7 @@ public function fopen($path, $mode) {
} catch (ForbiddenException $e) {
return false;
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while opening file']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand All @@ -414,6 +418,7 @@ public function rmdir($path) {
} catch (ForbiddenException $e) {
return false;
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while removing folder']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand All @@ -427,6 +432,7 @@ public function touch($path, $time = null) {
}
return false;
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while creating file']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
}
}
Expand Down Expand Up @@ -462,6 +468,7 @@ public function mkdir($path) {
$this->share->mkdir($path);
return true;
} catch (ConnectException $e) {
\OC::$server->getLogger()->logException($e, ['message' => 'Error while creating folder']);
throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
} catch (Exception $e) {
return false;
Expand Down Expand Up @@ -535,6 +542,7 @@ public function test() {
try {
return parent::test();
} catch (Exception $e) {
\OC::$server->getLogger()->logException($e);
return false;
}
}
Expand Down

0 comments on commit df84c3c

Please sign in to comment.