package cn.axzo.workflow.core.engine.event;

import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEventType;
import org.flowable.job.api.JobInfo;

import static cn.axzo.workflow.core.engine.event.ErrorInfoEventType.NEW_ERROR;

/**
 * 用于异步任务执行过程中出现的异常搜集和告警
 *
 * @author wangli
 * @since 2024/4/17 16:45
 */
public class ErrorInfoEvent implements FlowableEvent {
    private final JobInfo job;
    private final Throwable throwable;

    public ErrorInfoEvent(JobInfo job, Throwable throwable) {
        this.job = job;
        this.throwable = throwable;
    }

    @Override
    public FlowableEventType getType() {
        return NEW_ERROR;
    }

    public JobInfo getJob() {
        return job;
    }

    public Throwable getThrowable() {
        return throwable;
    }
}
