You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

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());
}
}