使用 IJobListener 获取作业异常 (Quartz.NET)
我正在 Quartz.NET 中使用 IJobListener 来审核所有作业成功/失败。当作业失败时,我希望将异常放入 IJobListener 中,以便也可以存储异常以供以后分析。
目前我的作业侦听器是这样的:
public virtual void JobWasExecuted(JobExecutionContext context, JobExecutionException x)
{
}
但是,即使作业的 Execute 方法中的所有事务都包含在带有 catch(Exception x) 的 try 中,然后我抛出该 try,JobExecutionException 的“x”也永远不会填充。
是否有一种特殊的方法来实际获取作业侦听器的异常?
谢谢
I'm using an IJobListener in Quartz.NET to audit all job successes/failures. When a job fails, I want the exception to be taken into the IJobListener so the exception can be stored too for later analysis.
Currently my job listener is like this:
public virtual void JobWasExecuted(JobExecutionContext context, JobExecutionException x)
{
}
But even though all transactions in the Execute method for the job are encased in a try with a catch(Exception x), which I then throw, the 'x' for JobExecutionException is never populated.
Is there a special way of actually getting the exception to the job listener?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你只是抛出异常吗?您是否尝试过将其包装在 JobWasExecuted 期望的正确类型中?
Do you just throw the Exception? Have you tried wrapping it in the right Type that JobWasExecuted is expecting?