#region << 版 本 注 释 >> /*---------------------------------------------------------------- * 命名空间:WIDESEAWCS_QuartzJob * 创建者:胡童庆 * 创建时间:2024/8/2 16:13:36 * 版本:V1.0.0 * 描述:自定义调度服务异常类 * * ---------------------------------------------------------------- * 修改人: * 修改时间: * 版本:V1.0.1 * 修改说明: * *----------------------------------------------------------------*/ #endregion << 版 本 注 释 >> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_QuartzJob.CustomException { /// /// 定时器错误类 /// [Serializable] public class QuartzJobException : Exception { /// /// 错误代码 /// public int? ErrorCode { get; } /// /// 错误类型 /// public string ErrorType { get; } public Exception? BaseException { get; } public override string Message => _message; private string _message; /// /// 初始化一个新的 CommunicationException 实例。 /// /// 错误的描述。 /// 错误类型。 /// 错误代码(可选)。 /// 导致当前异常的异常(可选)。 public QuartzJobException(string message, string errorType = "", int? errorCode = null, Exception? innerException = null) { ErrorCode = errorCode; ErrorType = errorType; BaseException = innerException; _message = message; } public override string ToString() { return base.ToString(); } } public enum QuartzJobErrorType { /// /// /// Warning, /// /// /// Error, /// /// /// Exception, /// /// /// LogicError } /// /// 调度服务异常 /// public class QuartzJobExceptionMessage { public const string StartJobException = "调度服务开启异常,错误信息:{0}"; public const string StopJobException = "调度服务停止异常,错误信息:{0}"; public const string AddJobException = "调度计划添加异常:【{0}】,错误信息:{1}"; public const string JobFactoryInstanceException = "从Factory中获取Scheduler实例异常,错误信息:{0}"; public const string StopAJobException = "调度计划【{0}】停止异常,错误信息:{1}"; public const string ResumeJobException = "调度计划【{0}】恢复异常,错误信息:{1}"; public const string ExecuteJobException = "立即执行调度计划:【{0}】异常,错误信息:{1}"; } /// /// 调度服务信息 /// public class QuartzJobInfoMessage { /// /// /// public const string JobHasStart = "调度服务已经开启"; /// /// /// public const string StartJobSuccess = "调度服务开启成功"; /// /// /// public const string JobHasStop = "调度服务已经停止"; /// /// /// public const string StopJobSuccess = "调度服务停止成功"; /// /// /// public const string JobHasAdd = "该调度计划已经在执行:【{0}】,请勿重复启动!"; /// /// /// public const string JobAddSuccess = "【{0}】调度计划添加到调度中心成功"; /// /// /// public const string JobNotExist = "调度计划不存在:【{0}】"; /// /// /// public const string StopAJobSuccess = "调度计划【{0}】停止成功"; /// /// /// public const string ResumeJobSuccess = "调度计划【{0}】恢复成功"; /// /// /// public const string ResumeJobNotExist = "未找到要恢复的调度计划:【{0}】"; /// /// /// public const string PauseJobSuccess = "调度计划【{0}】暂停成功"; /// /// /// public const string PauseJobNotExist = "未找到要暂停的调度计划:【{0}】"; /// /// /// public const string ExecuteJobSuccess = "立即执行调度计划:【{0}】成功"; } }