Information about the second issue:
If you want to see the useful detailed message for the custom exception you need to create a handler for the exception. For system exceptions, we don’t provide a detailed message about the server error.
You can create an exception handler through the Spring mechanisms. The class should declare in the ‘web’ module
Hadler example:
@ControllerAdvice("com.haulmont.addon.restapi.api.controllers")
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CustomRestControllerExceptionHandler {
private Logger log = LoggerFactory.getLogger(CustomRestControllerExceptionHandler.class);
@ExceptionHandler(CustomHttpClientErrorException.class)
@ResponseBody
public ResponseEntity<ErrorInfo> handleException(Exception e) {
log.error("Exception in REST controller", e);
CustomHttpClientErrorException ex = (CustomHttpClientErrorException) e;
ErrorInfo errorInfo = new ErrorInfo(ex.getStatusCode().getReasonPhrase(), ex.getStatusText());
return new ResponseEntity<>(errorInfo, ex.getStatusCode());
}
}
Use the current handler you can get a useful message.