возвращать BAD_REQUEST и message на фронт

как мне кинуть на фронт экзепшен, что бы в поле message, я посылал сообщение об ошибки?

@GetMapping(value = "/car")
public Car getCar() {
    Car car = service.getCar();
    if (car == null) {
       String errorMessage = "car is null";
       throw new ResponseStatusException(HttpStatus.BAD_REQUEST, errorMessage, new Exception(errorMessage));
    }
    return car;
}

что бы на фронте выводило что то типо такого:

{
   "message": "car is null"
}

или

{
"timestamp": "2020-08-13T15:32:54.388Z[UTC]",
"status": "Internal Server Error",
"message": "car is null",
"detailedMessage": "Unexpected exception. Cause: java.lang.Exception: car is null",
"debugMessage": [
    "com.project.StorageException: Unknown error: saveSummaryData",
    "org.springframework.web.server.ResponseStatusException: 400 BAD_REQUEST \"car is null\"; nested exception is java.lang.Exception: car is null",
    "java.lang.Exception: car is null"
],
"path": "/car"
}

но не так:

{
"timestamp": "2020-08-13T15:32:54.388Z[UTC]",
"status": "Internal Server Error",
"message": "Unknown error: getCar",
"detailedMessage": "Unexpected exception. Cause: java.lang.Exception: car is null",
"debugMessage": [
    "com.project.StorageException: Unknown error: getCar",
    "org.springframework.web.server.ResponseStatusException: 400 BAD_REQUEST \"car is null\"; nested exception is java.lang.Exception: car is null",
    "java.lang.Exception: car is null"
],
"path": "/summary/save"
}

Ответы (0 шт):