示例#1
0
 static void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         MailerContext.AddException(new tb_logs()
         {
             description        = e.Error.Message,
             error_code         = "999",
             error_description  = e.Error.Data != null ? JsonConvert.SerializeObject(e.Error.Data) : "",
             function_name      = "MAILER",
             msg_function       = "MAILER",
             msg_type           = "SEND MAIL",
             short_description  = "Error while sending mail",
             stack_trace        = e.Error.StackTrace,
             status             = "F",
             trace_data         = e.Error.InnerException == null ? "" : e.Error.InnerException.ToString(),
             transaction_ref_id = DateTime.UtcNow.Ticks.ToString(),
             user_Identifier    = null ///e.Result
         });
     }
 }
示例#2
0
 public static void Error <Req, Res>(Exception ex, string userId, string referenceId, string functionName, string messageFunction,
                                     string messageType, string shortDesc, Req Request, Res Response, string errorcode = "999", long logId = 0)
 {
     MailerContext.AddException(new tb_logs()
     {
         // Holds the response data
         description        = JsonConvert.SerializeObject(Request),
         error_code         = errorcode,
         error_description  = ex.ToString(),
         function_name      = functionName,
         msg_function       = messageFunction,
         msg_type           = messageType,
         short_description  = shortDesc,
         stack_trace        = ex.StackTrace,
         status             = "F",
         trace_data         = Response == null ? "" : JsonConvert.SerializeObject(Response),
         transaction_ref_id = referenceId,
         user_Identifier    = userId,
         log_id             = logId,
         created_on         = DateTime.UtcNow,
     });
 }