Skip to content

Commit

Permalink
Handle errors from external mappers. Closes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscoder committed Nov 26, 2024
1 parent 7080690 commit f24bb94
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/sdc/extract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from aiohttp import ClientSession
from aiohttp import ClientSession, web

from .constraint_check import constraint_check
from .exception import ConstraintCheckOperationOutcome
Expand Down Expand Up @@ -72,8 +72,11 @@ async def external_service_extraction(client, service, template, context):
"context": context,
},
) as result:
bundle = await result.json()
return await client.execute("/", data=bundle)
if 200 <= result.status <= 299:
bundle = await result.json()
return await client.execute("/", data=bundle)
else:
raise web.HTTPBadRequest(body=await result.text())


async def extract(client, mappings, context, extract_services):
Expand Down

0 comments on commit f24bb94

Please sign in to comment.