diff --git a/src/Adapter/Rackspace.php b/src/Adapter/Rackspace.php index 4b49e611a..501bc7ba7 100644 --- a/src/Adapter/Rackspace.php +++ b/src/Adapter/Rackspace.php @@ -5,6 +5,7 @@ use League\Flysystem\Util; use OpenCloud\ObjectStore\Resource\Container; use OpenCloud\ObjectStore\Resource\DataObject; +use OpenCloud\ObjectStore\Exception\ObjectNotFoundException; use Guzzle\Http\Exception\ClientErrorResponseException; class Rackspace extends AbstractAdapter @@ -163,6 +164,8 @@ public function has($path) $object = $this->getObject($path); } catch(ClientErrorResponseException $e) { return false; + } catch(ObjectNotFoundException $e) { + return false; } return $this->normalizeObject($object); diff --git a/tests/RackspaceTests.php b/tests/RackspaceTests.php index 9dfd7b5f5..c0db95f83 100644 --- a/tests/RackspaceTests.php +++ b/tests/RackspaceTests.php @@ -49,6 +49,14 @@ public function testHasFail() $this->assertFalse($adapter->has('filename.ext')); } + public function testHasNotFound() + { + $container = $this->getContainerMock(); + $container->shouldReceive('getObject')->andThrow('OpenCloud\ObjectStore\Exception\ObjectNotFoundException'); + $adapter = new Rackspace($container); + $this->assertFalse($adapter->has('filename.ext')); + } + public function testWrite() { $container = $this->getContainerMock();