JisoLya commented on PR #3029: URL: https://github.com/apache/hugegraph/pull/3029#issuecomment-4485202037
IMO, a controller should only be responsible for receiving external requests and returning responses — exception handling logic does not belong there. We should remove the catch blocks from controllers and let a centralized handler take care of error formatting. For the store business code, rather than replacing it with the HTTP status code, we could simply add a dedicated field (e.g. `storeBizCode`) to the response envelope to carry the original `HgStoreException` code alongside the HTTP status. That way transport semantics and domain error codes stay cleanly separated without losing any information. That said, it's worth classifying controllers by their audience — user-facing, admin-facing, or internal module-facing. Internal module-facing interfaces may reasonably keep their existing response format unchanged, while the unified response format should at minimum be enforced across all user-facing endpoints. On compatibility: could we treat this as a breaking change and land it in the next major/minor version with proper release notes and migration guidance? cc @imbajin -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
