mirror of https://github.com/apache/druid.git
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:
parent
616c46c958
commit
67f5aa65e7
|
@ -23,6 +23,7 @@ package org.apache.druid.server.initialization.jetty;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.ext.ExceptionMapper;
|
import javax.ws.rs.ext.ExceptionMapper;
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
|
@ -38,6 +39,7 @@ public class CustomExceptionMapper implements ExceptionMapper<JsonMappingExcepti
|
||||||
"error",
|
"error",
|
||||||
exception.getMessage() == null ? "unknown json mapping exception" : exception.getMessage()
|
exception.getMessage() == null ? "unknown json mapping exception" : exception.getMessage()
|
||||||
))
|
))
|
||||||
|
.type(MediaType.APPLICATION_JSON)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue