using JsonRPC4.Router.Abstractions; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace JsonRPC4.Router { public class OnExceptionResult { public bool ThrowException { get; } public object ResponseObject { get; } private OnExceptionResult(bool throwException, object responseObject) { ThrowException = throwException; ResponseObject = responseObject; } public static OnExceptionResult UseObjectResponse(object responseObject) { return new OnExceptionResult(throwException: false, responseObject); } public static OnExceptionResult UseMethodResultResponse(IRpcMethodResult result) { return new OnExceptionResult(throwException: false, result); } public static OnExceptionResult UseExceptionResponse(Exception ex) { return new OnExceptionResult(throwException: true, ex); } public static OnExceptionResult DontHandle() { return new OnExceptionResult(throwException: true, null); } } }