Throw the proper exceptions when the connection can't be established

This commit is contained in:
Robin Appelman 2013-03-14 23:23:46 +01:00
commit 2ed803907f
4 changed files with 55 additions and 4 deletions

View file

@ -26,7 +26,8 @@ class Share {
/**
* @param Server $server
* @param string $share
* @param string $name
* @throws ConnectionError
*/
public function __construct($server, $name) {
$this->server = $server;
@ -36,6 +37,9 @@ class Share {
' //' . $this->server->getHost() . '/' . $this->name;
$this->connection = new Connection($command);
$this->connection->write($this->server->getPassword());
if (!$this->connection->isValid()) {
throw new ConnectionError();
}
}
public function connect() {