Skip to content

Json exception handle #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ public int handleRequest(final InputStream input, final OutputStream output) thr
}
return jsonResponse.getCode();
} catch (JsonParseException | JsonMappingException e) {
JsonResponse responseError = createResponseError(VERSION, NULL, JsonError.PARSE_ERROR);
JsonError jsonError = new JsonError(JsonError.METHOD_PARAMS_INVALID.code, e.getMessage(), null);
JsonResponse responseError = createResponseError(VERSION, NULL, jsonError);
writeAndFlushValue(output, responseError.getResponse());
return responseError.getCode();
}
Expand Down Expand Up @@ -474,7 +475,7 @@ private JsonResponse handleObject(final ObjectNode node)
}

private JsonResponse handleParameterConvertError(ParameterConvertException pce, Object id, String jsonRpc) {
String errorMsg = "Failed to read method parameter at index " + pce.paramIndex;
String errorMsg = "Failed to read method parameter at index " + pce.paramIndex + ", " + pce.getCause().getMessage();
JsonError jsonError = new JsonError(
JsonError.METHOD_PARAMS_INVALID.code,
errorMsg,
Expand Down