示例#1
0
 public WafActionResponseWrapper GetErrorResponse(
     ILogger logger,
     WafActionResponseCodeEnum code,
     Exception exception,
     bool skipLogging = false)
 {
     return(GetErrorResponse(logger, code, exception?.Message, exception, skipLogging));
 }
示例#2
0
        public WafActionResponseWrapper GetErrorResponse(
            ILogger logger,
            WafActionResponseCodeEnum code,
            string errorMessage,
            Exception exception = null,
            bool skipLogging    = false)
        {
            if (!skipLogging)
            {
                if (exception == null)
                {
                    logger.LogError((int)code, errorMessage);
                }
                else
                {
                    logger.LogError((int)code, exception, errorMessage);
                }
            }

            return(new WafActionResponseWrapper()
            {
                Meta = new WafActionResponseMeta(code, errorMessage),
            });
        }
示例#3
0
 public WafActionResponseMeta(WafActionResponseCodeEnum code, string errorMessage = null)
 {
     Code         = code;
     ErrorMessage = errorMessage;
 }