mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Throw the proper exceptions when the connection can't be established
This commit is contained in:
parent
fc12434d28
commit
2ed803907f
4 changed files with 55 additions and 4 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue