50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
namespace ln.types.rpc
|
|
{
|
|
public class RPCResult
|
|
{
|
|
public object Identifier { get; set; }
|
|
|
|
public object Result { get; set; }
|
|
|
|
public String ErrorText { get; set; }
|
|
public Exception Exception { get; set; }
|
|
|
|
public RPCResult(RPCCall call)
|
|
{
|
|
Identifier = call.Identifier;
|
|
}
|
|
public RPCResult(RPCCall call,object result)
|
|
{
|
|
Identifier = call.Identifier;
|
|
Result = result;
|
|
}
|
|
public RPCResult(RPCCall call,Exception e)
|
|
{
|
|
Identifier = call.Identifier;
|
|
Exception = e;
|
|
ErrorText = e.ToString();
|
|
}
|
|
/*
|
|
public JObject ToJSON()
|
|
{
|
|
JObject result = new JObject();
|
|
result["id"] = JToken.FromObject(Identifier);
|
|
|
|
if (ErrorText != null)
|
|
{
|
|
result["error"] = new JObject();
|
|
result["error"]["message"] = JToken.FromObject(ErrorText);
|
|
result["error"]["exception"] = JToken.FromObject(Exception);
|
|
}
|
|
else
|
|
{
|
|
result["result"] = JToken.FromObject(Result);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
*/
|
|
}
|
|
}
|