public IApiResult AuditPass(IdsArguent arg) { OnAuditPass(); return(IsFailed ? ApiResultHelper.State(GlobalContext.Current.Status.LastState, GlobalContext.Current.Status.LastMessage) : ApiResultHelper.Succees()); }
private static void CheckException(IInlineMessage message, Exception exception) { switch (exception) { case ArgumentException _: message.ResultData = ApiResultHelper.State(OperatorStatusCode.ArgumentError, $"参数错误.{exception.Message}"); break; case DbException _: message.ResultData = ApiResultHelper.State(OperatorStatusCode.Ignore, $"数据库异常.{exception.Message}"); break; case NotSupportedException _: message.ResultData = ApiResultHelper.State(OperatorStatusCode.Ignore, $"不支持的方法.{exception.Message}"); break; case NullReferenceException _: message.ResultData = ApiResultHelper.State(OperatorStatusCode.Ignore, $"空引用错误.{exception.Message}"); break; case SystemException _: message.ResultData = ApiResultHelper.State(OperatorStatusCode.Ignore, $"系统级错误.{exception.Message}"); break; case MessageBusinessException mbe: CheckException(message, mbe.InnerException); break; default: message.ResultData = ApiResultHelper.State(OperatorStatusCode.UnhandleException, $"未知错误.{exception.Message}"); break; } }
public Task <IApiResult <string> > Error() { logger.LogInformation($"Call {nameof(Error)}"); var res = ApiResultHelper.State <string>(1); res = ApiResultHelper.State <string>(1, "测试失败"); res = ApiResultHelper.State <string>(1, "测试失败", "内部信息"); res = ApiResultHelper.State <string>(1, "测试失败", "内部信息", "这是测试", "没有解释"); return(Task.FromResult(res)); }
/// <summary> /// 数据校验 /// </summary> /// <param name="message">status</param> /// <returns>成功则返回真</returns> public bool Validate(out IOperatorStatus status) { if (Value == null) { status = ApiResultHelper.State(OperatorStatusCode.ArgumentError, "参数不能为空"); return(false); } status = null; return(true); }
public IApiResult Validate(IdsArguent arg) { if (!RequestArgumentConvert.TryGetIDs("selects", Convert, out List <TPrimaryKey> ids)) { return(ApiResultHelper.Helper.ArgumentError); } DoValidate(ids); return(IsFailed ? ApiResultHelper.State(GlobalContext.Current.Status.LastState, GlobalContext.Current.Status.LastMessage) : ApiResultHelper.Succees()); }