/** * Gets the error. * * @return the error */ public JSONRPCException getError() { if (resp.has(ERROR)) { final JsonNode error = resp.get(ERROR); try { return new JSONRPCException(error); } catch (JsonProcessingException e) { LOG.log(Level.WARNING, "Couldn't parse error", e); } } return null; }
throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Request is null"); throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Value of member 'jsonrpc' is not equal to '2.0'"); throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Member 'method' missing in request"); throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Member 'method' is no String"); throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Member 'params' is no ObjectNode");
throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Response is null"); throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Value of member 'jsonrpc' must be '2.0'"); && !jsonNode.get(ERROR).isNull(); if (hasError && !(jsonNode.get(ERROR).isObject())) { throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Member 'error' is no ObjectNode"); if (hasError) { try { error = new JSONRPCException(jsonNode.get(ERROR)); } catch (JsonProcessingException e) { throw new JSONRPCException(JSONRPCException.CODE.INVALID_REQUEST, "Member 'error' is no a real JSONRPCException.");
sender.call(receiverUrl, method, args, callback); } catch (final IOException e) { throw new JSONRPCException(CODE.REMOTE_EXCEPTION, e .getLocalizedMessage(), e); method.getGenericReturnType()); } catch (final Exception e) { throw new JSONRPCException( CODE.REMOTE_EXCEPTION, e .getLocalizedMessage(), e);
asyncCallback.onSuccess(res); } catch (final ClassCastException cce) { asyncCallback.onFailure(new JSONRPCException( "Incorrect return type received for JSON-RPC call:" + request.getMethod(), cce));
final JSONRPCException jsonError = new JSONRPCException( JSONRPCException.CODE.INTERNAL_ERROR, e.getMessage(), e); LOG.log(Level.WARNING, "Exception in receiving message", jsonError);
final AnnotatedMethod annotatedMethod = tuple.getMethod(); if (!isAvailable(annotatedMethod, realDest, requestParams, auth)) { throw new JSONRPCException( JSONRPCException.CODE.METHOD_NOT_FOUND, "Method '" + request, cause); final JSONRPCException jsonError = new JSONRPCException( JSONRPCException.CODE.INTERNAL_ERROR, getMessage(cause), cause); + request, err); final JSONRPCException jsonError = new JSONRPCException( JSONRPCException.CODE.INTERNAL_ERROR, getMessage(err), err);
@Override public void onSuccess(final JSONResponse response) { final Exception err = response.getError(); if (err != null) { asyncCallback.onFailure(err); } if (asyncCallback.getType() != null && !asyncCallback.getType().getJavaType().getRawClass() .equals(Void.class)) { try { final T res = asyncCallback.getType().inject( response.getResult()); asyncCallback.onSuccess(res); } catch (final ClassCastException cce) { asyncCallback.onFailure(new JSONRPCException( "Incorrect return type received for JSON-RPC call:" + request.getMethod(), cce)); } } else { asyncCallback.onSuccess(null); } }