001package org.consensusj.jsonrpc;
002
003import java.io.IOException;
004
005/**
006 * JSON RPC Exception
007 * <p>
008 * The {@link JsonRpcErrorException} subclass includes a {@link JsonRpcError} object which can be used
009 * in server implementations to pass error information to the server's response serialization layer which
010 * can include the {@link JsonRpcError} in the {@link JsonRpcResponse} and in client implementations it can
011 * be used for a client to find the {@link JsonRpcError} that was returned.
012 * <p>
013 * The {@link JsonRpcStatusException} subclass contains support for HTTP response code and message.
014 * <p>
015 * TODO: Rethink the differences between the two subclasses in light of Bitcoin (and possibly other)
016 * implementations returning HTTP status codes along with JsonRpcError responses. Bitcoin even incorrectly
017 * returns a 500 for invalid parameters. I think I originally assumed that there would be either an
018 * HTTP status error or a JSON-RPC error, but in reality responses can probably have neither, either, or both.
019 * @see <a href="https://github.com/bitcoin/bitcoin/issues/2960">Bitcoin Core Issue #2960</a>
020 */
021public class JsonRpcException extends IOException {
022
023    public JsonRpcException(String message) {
024        super(message);
025    }
026
027    public JsonRpcException(String message, Throwable cause) {
028        super(message, cause);
029    }
030
031}