Im trying to throw a 404 error for a spring rest api when nothing is found for an assignment, but it wont accept the exception im giving?
Warehouse warehouse = warehouseRepository.findById(warehouseId).orElseThrow(new ResponseStatusException(HttpStatus.NOT_FOUND, "No warehouses with specified ID were found"));
its giving me this compilation error:
reason: no instance(s) of type variable(s) X exist so that ResponseStatusException conforms to Supplier<? extends X>
This is my first time making a rest API, am I supposed to change the exception in some way for this to work?
question from:https://stackoverflow.com/questions/65945614/how-to-program-404-error-in-spring-rest-api