fix(trigger): enhance error handling and refactor end user creation in trigger workflows

- Improved error handling in `TriggerSubscriptionListApi` to return a 404 response for ValueErrors.
- Refactored end user creation logic in `service_api/wraps.py` to use `get_or_create_end_user` for better clarity and consistency.
- Introduced a new method `create_end_user_batch` for batch creation of end users, optimizing database interactions.
- Updated various trigger-related services to utilize the new end user handling, ensuring proper user context during trigger dispatching.
This commit is contained in:
Harry
2025-10-17 21:00:43 +08:00
parent 8a5174d078
commit 80f2c1be67
17 changed files with 429 additions and 323 deletions

View File

@ -81,6 +81,8 @@ class TriggerSubscriptionListApi(Resource):
tenant_id=user.current_tenant_id, provider_id=TriggerProviderID(provider)
)
)
except ValueError as e:
return jsonable_encoder({"error": str(e)}), 404
except Exception as e:
logger.exception("Error listing trigger providers", exc_info=e)
raise