FIX: Cambios a Servicios Toku

This commit is contained in:
Juan Pablo Vial
2025-05-09 18:03:33 -04:00
parent 400b2754bf
commit 8d73987ac3
6 changed files with 111 additions and 21 deletions

View File

@ -9,6 +9,7 @@ use Psr\Http\Message\ResponseInterface;
use Incoviba\Common\Define\Repository;
use Incoviba\Common\Implement\Exception\{EmptyResponse, EmptyResult};
use Incoviba\Common\Ideal\LoggerEnabled;
use Incoviba\Exception\InvalidResult;
abstract class AbstractEndPoint extends LoggerEnabled implements EndPoint
{
@ -147,7 +148,7 @@ abstract class AbstractEndPoint extends LoggerEnabled implements EndPoint
* @param string $id
* @param string $message
* @return array
* @throws EmptyResponse
* @throws InvalidResult
*/
protected function doGetById(callable $callable, string $id, string $message): array
{
@ -155,7 +156,7 @@ abstract class AbstractEndPoint extends LoggerEnabled implements EndPoint
$model = $callable($id);
return json_decode(json_encode($model), true);
} catch (EmptyResult $exception) {
throw new EmptyResponse($message, $exception);
throw new InvalidResult($message, 404, $exception);
}
}