Forge
csharp4405de34
1using System.Text.Json;
2
3namespace AgentClientProtocol;
4
5public class AcpException(string? message, JsonElement? data, int code, Exception? innerException = null) : Exception(message, innerException)
6{
7 public JsonElement? ErrorData { get; } = data;
8 public int Code { get; } = code;
9
10 public override string ToString()
11 {
12 return $"{Message}: {ErrorData}";
13 }
14
15 internal static void ThrowIfParamIsNull(in JsonElement? param)
16 {
17 if (!param.HasValue)
18 {
19 throw new AcpException("Params is null", null, (int)JsonRpcErrorCode.InvalidParams);
20 }
21 }
22}
View only · write via MCP/CIDE