mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
beter catching of errors
This commit is contained in:
parent
c91c970a8a
commit
cb96c44176
2 changed files with 15 additions and 1 deletions
|
|
@ -184,6 +184,8 @@ class Share {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* check output for errors
|
||||||
|
*
|
||||||
* @param $lines
|
* @param $lines
|
||||||
*
|
*
|
||||||
* @throws NotFoundException
|
* @throws NotFoundException
|
||||||
|
|
@ -202,7 +204,12 @@ class Share {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
$parts = explode(' ', $lines[0]);
|
$parts = explode(' ', $lines[0]);
|
||||||
$error = array_pop($parts);
|
$error = false;
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
if (substr($part, 0, 9) === 'NT_STATUS') {
|
||||||
|
$error = $part;
|
||||||
|
}
|
||||||
|
}
|
||||||
switch ($error) {
|
switch ($error) {
|
||||||
case ErrorCodes::PathNotFound:
|
case ErrorCodes::PathNotFound:
|
||||||
case ErrorCodes::ObjectNotFound:
|
case ErrorCodes::ObjectNotFound:
|
||||||
|
|
|
||||||
|
|
@ -262,4 +262,11 @@ class Share extends \PHPUnit_Framework_TestCase {
|
||||||
public function testDirNonExisting() {
|
public function testDirNonExisting() {
|
||||||
$this->share->dir('/foobar/asd');
|
$this->share->dir('/foobar/asd');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \SMB\NotFoundException
|
||||||
|
*/
|
||||||
|
public function testRmDirNonExisting(){
|
||||||
|
$this->share->rmdir('/foobar/asd');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue