Skip to content

Commit c5f6e95

Browse files
committed
添加一些上下文
1 parent 0b1ba59 commit c5f6e95

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

  • src/MediaConverters/MediaConverters.Tool/Contexts
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace DotNetCampus.MediaConverter.Contexts;
8+
9+
internal readonly record struct ErrorCode
10+
{
11+
/// <summary>
12+
/// 成功
13+
/// </summary>
14+
public static readonly ErrorCode Success = new(0, "Success");
15+
16+
/// <summary>
17+
/// 未知错误
18+
/// </summary>
19+
public static readonly ErrorCode UnknownError = new(-1, "Unknown error");
20+
21+
/// <summary>
22+
/// 错误代码
23+
/// </summary>
24+
public int Code { get; init; }
25+
26+
/// <summary>
27+
/// 错误信息
28+
/// </summary>
29+
public string Message { get; init; }
30+
31+
public ErrorCode(int code, string message)
32+
{
33+
Code = code;
34+
Message = message;
35+
36+
CodeList ??= [];
37+
CodeList.Add(this);
38+
}
39+
40+
private static List<ErrorCode>? CodeList { get; set; }
41+
}

0 commit comments

Comments
 (0)