JsonRpc/JsonRPC/Protocol/JsonRPCError.cs

27 lines
824 B
C#
Raw Normal View History

2025-10-14 21:05:08 +08:00
using System.Text.Json.Serialization;
namespace JsonRPC.Protocol
{
public enum EErrorCode
{
ParseError = -32700,// 解析错误,服务器收到无效的 JSON。
InvalidRequest = -32600, // 无效请求,发送的 JSON 不是有效的请求对象。
MethodNotFound = -32601, // 方法未找到,方法不存在或无效。
InvalidParam = -32602, // 无效参数,提供的参数无效。
InternalError = -32603, // 内部错误JSON-RPC 内部错误。
}
[Serializable]
public class JsonRPCError
{
[JsonPropertyName("data")]
public string? Data { get; set; }
[JsonPropertyName("code")]
public int Code { get; set; }
[JsonPropertyName("message")]
public string Message { get; set; } = null!;
}
}