Пример #1
0
        private static JsonRpcError ReadError(JToken token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }

            var errorCode = new JsonRpcErrorCode {
                Code    = (int)token["code"],
                Message = (string)token["message"],
            };
            var data = (string)token["data"];

            return(new JsonRpcError(errorCode, data));
        }
Пример #2
0
 /// <summary>
 /// The error codes from and including -32768 to -32000 are reserved for pre-defined errors.
 /// Any code within this range, but not defined explicitly below is reserved for future use.
 /// -32000 to -32099 (Server error) are reserved for implementation-defined server-errors.
 /// </summary>
 public JsonRpcError(JsonRpcErrorCode errorCode, object data = null)
 {
     Code    = errorCode.Code;
     Message = errorCode.Message;
     Data    = data?.ToString();
 }
Пример #3
0
 public JsonRpcException(JsonRpcErrorCode errorCode, Exception innerException)
     : base(errorCode.Message, innerException)
 {
     Error = new JsonRpcError(errorCode, innerException);
 }
Пример #4
0
 public JsonRpcException(JsonRpcErrorCode errorCode)
     : base(errorCode.Message)
 {
     Error = new JsonRpcError(errorCode);
 }