this is I write HttpMessageNotReadableException exception handling,
this" succ_flag "for type is a Boolean, now preach a number, how to change the MSG below error message to" succ_flag ": illegal request parameters, which is field name: request parameter illegal of this type, I was a novice, also, every brother please give directions, a lot, every brother please help, thank you,CodePudding user response:
Catch this exception@ ExceptionHandler (InvalidFormatException. Class)
Public R handHttpConverterException (InvalidFormatException e) {
String errors="";
ListPath=um participant etPath ();
For (JsonMappingException. Reference Reference: path) {
Errors +="parameter name:" + reference. GetFieldName () + "enter illegal, need is" + um participant etTargetType (). The getName () + "type," + "submit values are:" + um participant etValue (), toString ();
The info (" parameter name: {} ", the reference getFieldName ());
}
The info (" submit parameter values: {} ", um participant etValue (). The toString ());
Log. The info (" need parameter types: {} "+ um participant etTargetType () getName ());
Return R.e rror (errors);
}
