This commit is contained in:
f4ilji
2024-12-24 19:25:16 +05:00
parent ed7ac493a0
commit 700bf98de6
2 changed files with 17 additions and 3 deletions
@@ -3,6 +3,7 @@
namespace App\Services\Vicon\DirectionStudy;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class DirectionStudyService
{
@@ -72,10 +73,17 @@ class DirectionStudyService
try {
$response = Http::withToken($token)->get($endpoint);
$data = $response->object();
// Проверяем наличие сообщения об ошибке в ответе
if (isset($data->message)) {
throw new \Exception($data->message);
}
return $data;
} catch (\Exception $e) {
Log::error('Ошибка при вызове API: ' . $e->getMessage());
throw $e;
throw $e; // Перебрасываем исключение
}
}
}