Skip to content

Commit

Permalink
🐛 BASE #270 colocando try cat
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 27, 2022
1 parent b4e8ea5 commit bc75bcb
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions appexemplo_v2.0/api/api_controllers/Acesso_perfilAPI.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ public function __construct()
//--------------------------------------------------------------------------------
public static function selectAll(Request $request, Response $response, array $args)
{
$controller = new \Acesso_perfil();
$result = $controller->selectAll();
$result = \ArrayHelper::convertArrayFormDin2Pdo($result);
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
try{
$controller = new \Acesso_perfil();
$result = $controller->selectAll();
$result = \ArrayHelper::convertArrayFormDin2Pdo($result);
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
} catch ( \Exception $e) {
$msg = $e->getMessage();
$response = TGenericAPI::getBodyJson($msg,$response,500);
return $response;
}
}
//--------------------------------------------------------------------------------
private static function selectByIdInside(array $args)
Expand All @@ -46,13 +52,18 @@ private static function selectByIdInside(array $args)
//--------------------------------------------------------------------------------
public static function selectById(Request $request, Response $response, array $args)
{
$result = self::selectByIdInside($args);
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);

$response = TGenericAPI::getBodyJson($msg,$response);
return $response;
try{
$result = self::selectByIdInside($args);
$msg = array( 'qtd'=> \CountHelper::count($result)
, 'result'=>$result
);
$response = TGenericAPI::getBodyJson($msg,$response,200);
return $response;
} catch ( \Exception $e) {
$msg = $e->getMessage();
$response = TGenericAPI::getBodyJson($msg,$response,500);
return $response;
}
}
//--------------------------------------------------------------------------------
public static function save(Request $request, Response $response, array $args)
Expand Down

0 comments on commit bc75bcb

Please sign in to comment.