Improvements on catch errors
This commit is contained in:
parent
a6d39f7666
commit
b433cf3d60
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "medialabufg/tainacan-test-repo",
|
||||
"description": "Protótipo",
|
||||
"name": "medialabufg/tainacan",
|
||||
"description": "Transforme seu site wordpress em um repositório digital.",
|
||||
"type": "wordpress-plugin",
|
||||
"require": {
|
||||
"respect/validation": "^1.1"
|
||||
|
|
|
@ -23,4 +23,4 @@
|
|||
"webpack": "2.1.0-beta.25",
|
||||
"webpack-dev-server": "2.1.0-beta.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ class Entity_Factory {
|
|||
* @throws \ErrorException
|
||||
*/
|
||||
public function create_entity($type, $args = [], $is_validated_and_in_db = false){
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
try {
|
||||
if(empty($type)){
|
||||
throw new \InvalidArgumentException(__('The type can\'t be empty'));
|
||||
|
@ -79,7 +81,7 @@ class Entity_Factory {
|
|||
try {
|
||||
$this->entity->set_name( "$type" . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
} catch (\Exception $exception){
|
||||
} catch (\Error $exception){
|
||||
$this->entity->set_title( "$type" . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
}
|
||||
|
@ -88,7 +90,7 @@ class Entity_Factory {
|
|||
try {
|
||||
$this->entity->set_name( "$type" . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
} catch (\Exception $exception){
|
||||
} catch (\Error $exception){
|
||||
$this->entity->set_title( "$type" . random_int( 0, 10000 ) . " for test" );
|
||||
$this->entity->set_description( 'It is only for test' );
|
||||
}
|
||||
|
@ -103,9 +105,8 @@ class Entity_Factory {
|
|||
} else {
|
||||
throw new \InvalidArgumentException( __( 'One or more arguments are invalid.', 'tainacan' ) );
|
||||
}
|
||||
} catch (\Exception $exception){
|
||||
echo($exception->getMessage());
|
||||
echo($exception->getTraceAsString());
|
||||
} catch (\Error $exception){
|
||||
echo "\n" . $exception->getMessage() . "\n";
|
||||
}
|
||||
|
||||
return $this->entity;
|
||||
|
|
Loading…
Reference in New Issue