diff --git a/src/SearchAPI/application/application.py b/src/SearchAPI/application/application.py index a29fbac..8116389 100644 --- a/src/SearchAPI/application/application.py +++ b/src/SearchAPI/application/application.py @@ -268,22 +268,22 @@ def validate_wkt(wkt: str): } def _get_aria_baseline_stack(reference: str, opts: asf.ASFSearchOptions, output: str): - if output.lower() == 'count': - stack_opts = asf.Products.ARIAS1GUNWProduct.get_stack_opts_for_frame(int(reference), opts=opts) - count=asf.search_count(opts=stack_opts) - return Response( - content=str(count), - status_code=200, - media_type='text/html; charset=utf-8', - headers=constants.DEFAULT_HEADERS - ) - try: - stack = asf.stack_from_id(reference, opts=opts) - response_info = as_output(stack, output) - return Response(**response_info) - except (KeyError, IndexError, ValueError) as exc: - raise HTTPException(detail=f"Reference scene not found with frame: {reference}", status_code=400) from exc - + if output.lower() == 'count': + stack_opts = asf.Products.ARIAS1GUNWProduct.get_stack_opts_for_frame(int(reference), opts=opts) + count=asf.search_count(opts=stack_opts) + return Response( + content=str(count), + status_code=200, + media_type='text/html; charset=utf-8', + headers=constants.DEFAULT_HEADERS + ) + try: + stack = asf.stack_from_id(reference, opts=opts) + response_info = as_output(stack, output) + return Response(**response_info) + except (KeyError, IndexError, ValueError) as exc: + raise HTTPException(detail=f"Ran into an issue building stack for frame: {reference}\nException: {str(exc)}", status_code=400) from exc + @router.get('/', response_class=JSONResponse) @router.get('/health', response_class=JSONResponse)