服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-11-12 606bc04a01c35aeff25ab512c65d517bc29e36ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rhea.Common;
 
namespace Tiger.IBusiness
{
    public static class ResultExtension
    {
        public static Result<T> CatchExceptionWithLog<T>(this Result<T> result, Exception ex, Locale localeMsg, T data)
        {
            result.Data = data;
            return CatchExceptionWithLog<T>(result, ex, localeMsg);
        }
 
        public static Result<T> CatchExceptionWithLog<T>(this Result<T> result, Exception ex, Locale localeMsg)
        {
            result.CatchExceptionWithLog(ex, localeMsg);
            Logger.Default.Fatal(ex, localeMsg.Default());
            return result;
        }
 
        public static Result<T> CatchExceptionWithLog<T>(this Result<T> result, Exception ex, string msg, T data)
        {
            result.Data = data;
            return CatchExceptionWithLog<T>(result, ex, msg);
        }
 
        public static Result<T> CatchExceptionWithLog<T>(this Result<T> result, Exception ex, string msg = null)
        {
            result.CatchExceptionWithLog(ex, msg);
            Logger.Default.Fatal(ex, msg);
            return result;
        }
 
        public static Result CatchExceptionWithLog(this Result result, Exception ex, Locale localeMsg, object data)
        {
            result.Data = data;
            return CatchExceptionWithLog(result, ex, localeMsg);
        }
 
        public static Result CatchExceptionWithLog(this Result result, Exception ex, Locale localeMsg)
        {
            result.CatchExceptionWithLog(ex, localeMsg);
            Logger.Default.Fatal(ex, localeMsg.Default());
            return result;
        }
 
        public static Result CatchExceptionWithLog(this Result result, Exception ex, string msg, object data)
        {
            result.Data = data;
            return CatchExceptionWithLog(result, ex, msg);
        }
 
        public static Result CatchExceptionWithLog(this Result result, Exception ex, string msg = null)
        {
            result.CatchExceptionWithLog(ex, msg);
            Logger.Default.Fatal(ex, msg);
            return result;
        }
    }
}