Skip to content

[studio] feat: add common Result wrapper, BusinessException and Globa… - #656

Closed
zhaohai666 wants to merge 1 commit into
apache:rocketmq-studiofrom
zhaohai666:pr-01-common-foundation
Closed

[studio] feat: add common Result wrapper, BusinessException and Globa…#656
zhaohai666 wants to merge 1 commit into
apache:rocketmq-studiofrom
zhaohai666:pr-01-common-foundation

Conversation

@zhaohai666

Copy link
Copy Markdown

Summary

  • Add generic Result<T> API response wrapper with ok()/error() factory methods for standardized REST responses
  • Add BusinessException with integer error code for domain-level error handling
  • Add GlobalExceptionHandler (@RestControllerAdvice) to handle BusinessException, PrometheusException, validation errors (MethodArgumentNotValidException), and malformed requests (HttpMessageNotReadableException)
  • Include PrometheusException as a dependency for the metrics module (PR-02)

Test plan

  • Verify Result.ok() and Result.error() return correct status/data/errMsg fields
  • Verify GlobalExceptionHandler catches BusinessException and returns proper HTTP 400 response
  • Verify GlobalExceptionHandler catches validation errors and returns proper response
  • Verify PrometheusException carries HTTP status code correctly

…lExceptionHandler

- Add generic Result<T> response wrapper with ok()/error() factory methods
- Add BusinessException with integer error code support
- Add GlobalExceptionHandler with handlers for BusinessException,
  PrometheusException, validation errors, and malformed requests
- Include PrometheusException as base exception for metrics module
@zhaohai666 zhaohai666 closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant