001/*
002 *    Copyright 2024-2025, Warm-Flow (290631660@qq.com).
003 *
004 *    Licensed under the Apache License, Version 2.0 (the "License");
005 *    you may not use this file except in compliance with the License.
006 *    You may obtain a copy of the License at
007 *
008 *       https://www.apache.org/licenses/LICENSE-2.0
009 *
010 *    Unless required by applicable law or agreed to in writing, software
011 *    distributed under the License is distributed on an "AS IS" BASIS,
012 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *    See the License for the specific language governing permissions and
014 *    limitations under the License.
015 */
016package org.dromara.warm.flow.core.exception;
017
018/**
019 * 流程异常
020 *
021 * @author warm
022 */
023public final class FlowException extends RuntimeException {
024    private static final long serialVersionUID = 1L;
025
026    /**
027     * 错误码
028     */
029    private Integer code;
030
031    /**
032     * 错误提示
033     */
034    private String message;
035
036    /**
037     * 错误明细,内部调试错误
038     */
039    private String detailMessage;
040
041    /**
042     * 空构造方法,避免反序列化问题
043     */
044    public FlowException() {
045    }
046
047    public FlowException(String message) {
048        this.message = message;
049    }
050
051    public FlowException(String message, Throwable cause) {
052        super(message, cause);
053        this.message = message;
054    }
055
056    public FlowException(String message, Integer code) {
057        this.message = message;
058        this.code = code;
059    }
060
061    public String getDetailMessage() {
062        return detailMessage;
063    }
064
065    public FlowException setDetailMessage(String detailMessage) {
066        this.detailMessage = detailMessage;
067        return this;
068    }
069
070    @Override
071    public String getMessage() {
072        return message;
073    }
074
075    public FlowException setMessage(String message) {
076        this.message = message;
077        return this;
078    }
079
080    public Integer getCode() {
081        return code;
082    }
083}