I've been searching to find a way to customise exception thrown by Jackson
bind on GAE
.
The problem is that when I sent a string parameter where API
method expects Integer
throws a Jackson
's InvalidFormatException
. I want to customize the message thrown by the exception but I couldn't find a way. Please help with this.
For e.g:
@Api(
name = "echo",
version = "v1",
namespace =
@ApiNamespace(
ownerDomain = "echo.example.com",
ownerName = "echo.example.com",
packagePath = ""
),
issuers = {
@ApiIssuer(
name = "firebase",
issuer = "https://securetoken.google.com/YOUR-PROJECT-ID",
jwksUri =
"https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system"
+ ".gserviceaccount.com"
)
})
public class Echo {
@ApiMethod(name = "echo")
public Message echo(Message message, @Named("n") @Nullable Integer n) {
return doEcho(message, n);
}
}
In the above code if the echo endpoint is hit with payload
then the response is
In this case is it possible to throw a custom exception or customize the message