Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved logging of smb connection errors #10090

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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