
package com.tmerclub.cloud.common.exception;

import com.tmerclub.cloud.common.response.ResponseEnum;
import com.tmerclub.cloud.common.response.ServerResponseEntity;

/**
 * @author tmerclub
 * @date 2020/7/11
 */
public class LuckException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * http状态码
     */
    private String code;

    private Object object;

    private ResponseEnum responseEnum;

    private ServerResponseEntity<?> serverResponseEntity;

    public LuckException(String msg) {
        super(msg);
    }

    public LuckException(String msg, Object object) {
        super(msg);
        this.object = object;
    }

    public LuckException(String msg, String code) {
        super(msg);
        this.code = code;
    }

    public LuckException(String msg, Throwable cause) {
        super(msg, cause);
    }


    public LuckException(ResponseEnum responseEnum) {
        super(responseEnum.getMsg());
        this.responseEnum = responseEnum;
        this.code = responseEnum.value();
    }

    public LuckException(ResponseEnum responseEnum, Object object) {
        super(responseEnum.getMsg());
        this.responseEnum = responseEnum;
        this.object = object;
        this.code = responseEnum.value();
    }

    public LuckException(ServerResponseEntity<?> serverResponseEntity) {
        this.serverResponseEntity = serverResponseEntity;
    }

    public ServerResponseEntity<?> getServerResponseEntity() {
        return serverResponseEntity;
    }

    public Object getObject() {
        return object;
    }

    public ResponseEnum getResponseEnum() {
        return responseEnum;
    }

    public String getCode() {
        return code;
    }

}
