fix(invoicing): return clear error on Facturapi config issues instead of 500
This commit is contained in:
@@ -12,6 +12,7 @@ from flask import Blueprint, g, jsonify, request
|
|||||||
from middleware import require_auth
|
from middleware import require_auth
|
||||||
from services import facturapi_service
|
from services import facturapi_service
|
||||||
from services.audit import log_action
|
from services.audit import log_action
|
||||||
|
from services.facturapi_service import FacturapiError
|
||||||
from services.cfdi_facturapi_builder import (
|
from services.cfdi_facturapi_builder import (
|
||||||
build_egreso_payload,
|
build_egreso_payload,
|
||||||
build_ingreso_payload,
|
build_ingreso_payload,
|
||||||
@@ -694,6 +695,11 @@ def facturapi_setup():
|
|||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
return jsonify({"error": str(e)}), 400
|
return jsonify({"error": str(e)}), 400
|
||||||
|
except FacturapiError as e:
|
||||||
|
conn.rollback()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
return jsonify({"error": str(e)}), 400
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
cur.close()
|
cur.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user