public virtual HistoryEvent CreateHistoricJobLogFailedEvt(IJob job, System.Exception exception) { HistoricJobLogEventEntity @event = (HistoricJobLogEventEntity)CreateHistoricJobLogEvt(job, HistoryEventTypes.JobFail); if (exception != null) { // exception message @event.JobExceptionMessage = exception.Message; // stacktrace string exceptionStacktrace = ExceptionUtil.GetExceptionStacktrace(exception); byte[] exceptionBytes = StringUtil.ToByteArray(exceptionStacktrace); ResourceEntity byteArray = ExceptionUtil.CreateJobExceptionByteArray(exceptionBytes); @event.ExceptionByteArrayId = byteArray.Id; } return(@event); }