JavaWebStack / JavaWebStack/http-router

Throw proper exception when request parsing fails

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Currently calling the .body method (or injecting it) and sending invalid content to the endpoint throws a generic java.text.ParseException or MapperWrongTypeException from abstract-data. The stacktrace is hard to debug since it doesn't contain any context (endpoint, invalid data, etc.)

Instead we should throw an exception that contains more context and can be properly handled in the exception handler and responded to.

1. Invalid request body throws a specific exception
2. The default exception handler, responds with 400

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the request parsing path used by the .body method or body injection, then trace how ParseException and MapperWrongTypeException reach the default exception handler. Add context to the request-body failure and verify that invalid bodies produce a specific exception and a 400 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.