8 changed files with 129 additions and 62 deletions
@ -0,0 +1,54 @@ |
|||||
|
namespace EC.Helper.CameraSDK; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 相机异常
|
||||
|
/// </summary>
|
||||
|
public class CameraException : Exception |
||||
|
{ |
||||
|
public CameraException() : base() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public CameraException(string? message) : base(message) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public CameraException(string? message, Exception? innerException) : base(message, innerException) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
protected class CameraExceptionObj |
||||
|
{ |
||||
|
public CameraType Type { get; set; } |
||||
|
|
||||
|
public int ErrCode { get; set; } |
||||
|
|
||||
|
public string? ErrMsg { get; set; } |
||||
|
|
||||
|
public override string? ToString() |
||||
|
{ |
||||
|
return $"Type:{Type}, ErrCode:{ErrCode}, ErrMsg:{ErrMsg}"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static CameraException New(CameraType type, int errCode) |
||||
|
{ |
||||
|
CameraExceptionObj obj = new() |
||||
|
{ |
||||
|
Type = type, |
||||
|
ErrCode = errCode |
||||
|
}; |
||||
|
return new CameraException(obj.ToString()); |
||||
|
} |
||||
|
|
||||
|
public static CameraException New(CameraType type, int errCode, string errMsg) |
||||
|
{ |
||||
|
CameraExceptionObj obj = new() |
||||
|
{ |
||||
|
Type = type, |
||||
|
ErrCode = errCode, |
||||
|
ErrMsg = errMsg |
||||
|
}; |
||||
|
return new CameraException(obj.ToString()); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue