diff options
| author | Yoggzo <yogg@epsina.com> | 2016-02-17 17:56:11 +0100 |
|---|---|---|
| committer | Yoggzo <yogg@epsina.com> | 2016-02-17 17:56:11 +0100 |
| commit | 58a936d0158e4f90596bfe88352f5a570094c436 (patch) | |
| tree | 949de7b6edb8bb352259de7a7a2560fc4aa8ebe2 | |
| parent | 81bc109269722745a475eac0f7aa9d14b3ffe66b (diff) | |
Add errors features for tests calsses
| -rwxr-xr-x | server/Test/AppTestClass.php | 13 | ||||
| -rw-r--r-- | server/core/Image.php | 10 |
2 files changed, 19 insertions, 4 deletions
diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 311b9bf..40a5847 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -1,6 +1,12 @@ <?php
include_once("../core/Plugin_Api.php");
include_once("../core/LibOverride/genTokenOptions.php");
+include_once("../core/ErrorManagement.php");
+
+use OpenStack\Common\Error\BadResponseError;
+use OpenStack\Common\Error\BaseError;
+use OpenStack\Common\Error\NotImplementedError;
+use OpenStack\Common\Error\UserInputError;
class AppTest{
@@ -9,6 +15,7 @@ class AppTest{ protected $tokenClass;
protected $tokenPost;
protected $output;
+ protected $errorClass;
public function __construct($args){
@@ -17,6 +24,7 @@ class AppTest{ $this->openstack = new OpenStack\OpenStack([]);
$this->pluginsApi = plugin_api::getInstance();
$this->output = array();
+ $this->errorClass = new errorManagement($this);
}
@@ -70,4 +78,9 @@ class AppTest{ echo json_encode($this->output);
}
+ public function getErrorInstance(){
+
+ return $this->errorClass;
+
+ }
}
\ No newline at end of file diff --git a/server/core/Image.php b/server/core/Image.php index 15facc9..bc4834a 100644 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -9,8 +9,11 @@ * * @todo Complete the functions with errors detection and finish the descriptions */ -use OpenStack\Common\Error; - +use OpenStack\Common\Error\BadResponseError; +use OpenStack\Common\Error\BaseError; +use OpenStack\Common\Error\NotImplementedError; +use OpenStack\Common\Error\UserInputError; + /** * Image Class of the back-end application * @@ -190,8 +193,7 @@ class image { $service = $this->libClass; $service->getImage($id)->delete(); }catch(BadResponseError $e){ - echo "YOLO"; - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ $this->app->getErrorInstance->UserInputHandler($e); }catch(BaseError $e){ |
