Bad Request error handling issue
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java, spring-boot
Research direction
Start by locating GlobalControllerExceptionhandler and review how missing required REST parameters are currently handled. Check the existing BadRequestException handling and add coverage for MissingRequestValueException as described in the issue. Done means a request missing a required parameter is captured and returns a 400 response with HttpErrorInfo.
Written by the indexing model from the issue text.
Description
If there's no required parameter from rest call, the GlobalControllerExceptionhandler will never capture it since BadQuestException is never instantiated and thrown. To capture 400 error, you have to do this (using MissingRequestValueException):
@ResponseStatus(BAD_REQUEST)
@ExceptionHandler(MissingRequestValueException.class)
public @ResponseBody HttpErrorInfo handleBadRequestExceptions(
ServerHttpRequest request, MissingRequestValueException ex) {
return createHttpErrorInfo(BAD_REQUEST, request, ex);
}
- Dominant language
- Java
- Stars
- 47
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PacktPublishing/Microservices-with-Spring-Boot-and-Spring-Cloud-Fourth-Edition
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
PacktPublishing/Microservices-with-Spring-Boot-and-Spring-Cloud-Fourth-Edition#2 ·
All issues in PacktPublishing/Microservices-with-Spring-Boot-and-Spring-Cloud-Fourth-Edition
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100