wrap db call in try except
This commit is contained in:
parent
28e62f3333
commit
79fc0b9be4
1 changed files with 10 additions and 6 deletions
|
|
@ -84,6 +84,7 @@ async def api_tpos_create_invoice(
|
||||||
|
|
||||||
@tpos_ext.get("/api/v1/tposs/{tpos_id}/invoices")
|
@tpos_ext.get("/api/v1/tposs/{tpos_id}/invoices")
|
||||||
async def api_tpos_get_latest_invoices(tpos_id: str = None):
|
async def api_tpos_get_latest_invoices(tpos_id: str = None):
|
||||||
|
try:
|
||||||
payments = [
|
payments = [
|
||||||
Payment.from_row(row)
|
Payment.from_row(row)
|
||||||
for row in await get_latest_payments_by_extension(
|
for row in await get_latest_payments_by_extension(
|
||||||
|
|
@ -91,6 +92,9 @@ async def api_tpos_get_latest_invoices(tpos_id: str = None):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
raise HTTPException(status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail=str(e))
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"checking_id": payment.checking_id,
|
"checking_id": payment.checking_id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue