Set response type `application/json` in CustomExceptionMapper to return correct failure message (#17016)

* Add produces annotation to ParallelIndexSupervisorTask#report

* change to application/json

* Set response type in CustomExceptionMapper instead
This commit is contained in:
Rishabh Singh 2024-09-09 12:07:05 +05:30 committed by GitHub
parent 616c46c958
commit 67f5aa65e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -23,6 +23,7 @@ package org.apache.druid.server.initialization.jetty;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.google.common.collect.ImmutableMap;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@ -38,6 +39,7 @@ public class CustomExceptionMapper implements ExceptionMapper<JsonMappingExcepti
"error",
exception.getMessage() == null ? "unknown json mapping exception" : exception.getMessage()
))
.type(MediaType.APPLICATION_JSON)
.build();
}
}