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.
59 lines
1.4 KiB
59 lines
1.4 KiB
using System.Text;
|
|
|
|
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 CameraManufactor Manufactor { get; set; }
|
|
|
|
public int Code { get; set; }
|
|
|
|
public string? Msg { get; set; }
|
|
|
|
public override string? ToString()
|
|
{
|
|
StringBuilder builder = new();
|
|
builder.Append($"Manufactor:{Manufactor}, Code:{Code}");
|
|
if (!string.IsNullOrEmpty(Msg)) builder.Append($", Msg:{Msg}");
|
|
return builder.ToString();
|
|
}
|
|
}
|
|
|
|
public static CameraException New(CameraManufactor manufactor, int code)
|
|
{
|
|
CameraExceptionObj obj = new()
|
|
{
|
|
Manufactor = manufactor,
|
|
Code = code
|
|
};
|
|
return new CameraException(obj.ToString());
|
|
}
|
|
|
|
public static CameraException New(CameraManufactor manufactor, int code, string msg)
|
|
{
|
|
CameraExceptionObj obj = new()
|
|
{
|
|
Manufactor = manufactor,
|
|
Code = code,
|
|
Msg = msg
|
|
};
|
|
return new CameraException(obj.ToString());
|
|
}
|
|
}
|