fix: gracefully fail if symbol not found

This commit is contained in:
hackerESQ
2025-01-28 19:48:20 -06:00
parent eac5de0d4a
commit 0f135f4024
@@ -14,8 +14,17 @@ class MarketDataController extends ApiController
public function show(Request $request, string $symbol)
{
return MarketDataResource::make(
MarketData::getMarketData($symbol)
);
try {
return MarketDataResource::make(
MarketData::getMarketData($symbol)
);
} catch (\Throwable $e) {
return response([
'message' => 'Symbol '.$symbol.' not found.',
], 404);
}
}
}