ErrorManagement Class Introduction
This commit is contained in:
parent
af451ad442
commit
294fbb4d11
4 changed files with 100 additions and 7 deletions
|
@ -1,13 +1,21 @@
|
|||
<?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 App{
|
||||
|
||||
protected $openstack;
|
||||
protected $pluginsApi;
|
||||
protected $postParams;
|
||||
protected $tokenClass;
|
||||
protected $tokenPost;
|
||||
protected $errorClass;
|
||||
protected $output;
|
||||
|
||||
public function __construct($args){
|
||||
|
@ -16,7 +24,9 @@ class App{
|
|||
$this->tokenClass = new genTokenOptions($args);
|
||||
$this->openstack = new OpenStack\OpenStack([]);
|
||||
$this->pluginsApi = plugin_api::getInstance();
|
||||
$this->errorClass = new errorManagement($this);
|
||||
$this->output = array();
|
||||
$this->postParams = $_POST;
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,19 +63,37 @@ class App{
|
|||
$this->tokenClass->genNetworkToken();
|
||||
|
||||
$this->setOutput("token", $this->tokenClass->getBackup());
|
||||
}catch(Exception $e){
|
||||
echo $e;
|
||||
}catch(BadResponseError $e){
|
||||
var_dump($e);
|
||||
}catch(UserInputError $e){
|
||||
var_dump($e);
|
||||
}catch(BaseError $e){
|
||||
var_dump($e);
|
||||
exit();
|
||||
}catch(NotImplementedError $e){
|
||||
var_dump($e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPostParam($name){
|
||||
|
||||
return $this->postParams[$name];
|
||||
|
||||
}
|
||||
|
||||
public function setOutput($key, $out){
|
||||
|
||||
$this->output[$key] = $out;
|
||||
|
||||
}
|
||||
|
||||
public function getErrorInstance(){
|
||||
|
||||
return $this->errorClass;
|
||||
|
||||
}
|
||||
|
||||
public function show(){
|
||||
echo json_encode($this->output);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue