Files
rkm-conectasus-ci-sandbox/api/app/Exceptions/WebService/Ambulatorio/ConectaSus/LocalAnatomicoNotFoundException.php
Antonio Lopes dos Santos afec302c3e
All checks were successful
build-api-image / build (push) Successful in 51s
init commit
2026-08-04 16:52:02 -03:00

29 lines
728 B
PHP

<?php
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
use Exception;
use Illuminate\Http\Response;
class LocalAnatomicoNotFoundException extends Exception
{
private string $valor;
private ?int $indice;
public function __construct(string $valor, ?int $indice = null)
{
$this->valor = $valor;
$this->indice = $indice;
parent::__construct();
}
public function render()
{
$msg = "Local anatômico '{$this->valor}' não encontrado.";
if ($this->indice !== null) {
$msg = "Ferida [{$this->indice}]: {$msg}";
}
return response()->json([
'message' => $msg
], Response::HTTP_UNPROCESSABLE_ENTITY);
}
}