FocusConfigMissingException.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. namespace IvfTl.AutoFocus.Layout
  3. {
  4. /// <summary>
  5. /// 对焦层配置缺失专用异常(§2.5:层间距等关键配置两级皆空时抛出,不用魔法数兜底)。
  6. /// 调用方(M2-03/M2-05)据此弹"请先配置"告警并跳过本轮,而不是用硬编码值继续。
  7. /// 携带设备 tl_sn / 仓室 / well 信息供告警与定位。
  8. /// </summary>
  9. public sealed class FocusConfigMissingException : Exception
  10. {
  11. /// <summary>设备 tl_sn。</summary>
  12. public string TlSn { get; }
  13. /// <summary>仓室编号。</summary>
  14. public int HouseSn { get; }
  15. /// <summary>well 编号。</summary>
  16. public int WellSn { get; }
  17. /// <summary>
  18. /// 默认消息:层间距未配置。消息形如"设备{tlSn}对焦层间距未配置,请先初始化"(§2.5)。
  19. /// </summary>
  20. public FocusConfigMissingException(string tlSn, int houseSn, int wellSn)
  21. : this(tlSn, houseSn, wellSn, $"设备{tlSn}对焦层间距未配置,请先初始化")
  22. {
  23. }
  24. /// <summary>自定义消息(用于层数/下移等其它缺失场景)。</summary>
  25. public FocusConfigMissingException(string tlSn, int houseSn, int wellSn, string message)
  26. : base(message)
  27. {
  28. TlSn = tlSn;
  29. HouseSn = houseSn;
  30. WellSn = wellSn;
  31. }
  32. }
  33. }