Skip to content

void return type in Spring @ExceptionHandler should work without a @ResponseStatus annotation #5392

@hantsy

Description

@hantsy

I played more examples of exception handling except the ones mentioned in #4042 .

The following exception handling should work.

 @ExceptionHandler(Exception2.class)
 public void handleException2(Exception2 e, HttpServletResponse response) throws IOException {
        response.setHeader("Content-Type", "application/json");
        response.getWriter().write(e.getMessage());
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
 }

But in the startup stage, Quarkus will complain it should be used with a @ResponseStatus.

Metadata

Metadata

Assignees

Labels

area/springIssues relating to the Spring integrationkind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions