Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response wrong status code for some situation for openAPI #11842

Closed
KomachiSion opened this issue Mar 18, 2024 · 1 comment
Closed

Response wrong status code for some situation for openAPI #11842

KomachiSion opened this issue Mar 18, 2024 · 1 comment
Assignees
Labels
contribution welcome kind/bug Category issues or prs related to bug.

Comments

@KomachiSion
Copy link
Collaborator

Describe the bug
Some situation for openAPI will return wrong status code, such as:

Register one persistent instance for A service first, and then try to register one ephemeral instance to A service.
For expected get an 400 error because a persistent service can't register ephemeral instance, the error message is right.
But the status code is 500.

For research, The reason is the check logic is throw the NacosRuntimeException with 400 errorCode, But the ResponseExceptionHandler in nacos-naming module did not handle NacosRuntimeException type but as normal Exception to handle, which will cause the status code is 500.

Expected behavior
NacosRuntimeException can be handle right and the response status code can same with NacosRuntimeException.

Actually behavior
NacosRuntimeException will all change to 500 code.

Additional context
BTW, expect ResponseExceptionHandler in nacos-naming , other ExceptionHandler such as GlobalExceptionHandler in nacos-config, ConsoleExceptionHandler in nacos-console, PrometheusApiExceptionHandler in nacos-prometheus also should handle NacosRuntimeException.

@KomachiSion KomachiSion added kind/bug Category issues or prs related to bug. contribution welcome labels Mar 18, 2024
@shalk
Copy link
Contributor

shalk commented Mar 19, 2024

i will resolve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome kind/bug Category issues or prs related to bug.
Projects
None yet
Development

No branches or pull requests

2 participants