package com.colorful.keyboard.theme.net;

/**
 * Created by A on 2017/12/1.
 */

public class ApiException extends Exception {
    private final int    code;
    private String message;

    public static final int UNKNOWN     = 1000;
    public static final int PARSE_ERROR = 1001;
    private final Throwable mThrowable;

    public ApiException(Throwable throwable, int code) {
        super(throwable);
        mThrowable = throwable;
        this.code = code;
    }

    /*public ApiException(Throwable throwable, int code) {
        super(throwable);
        mThrowable = throwable;
        this.code = code;
    }*/

    public int getCode() {
        return code;
    }

    public String getDisplayMessage() {
        return mThrowable.getMessage();
    }

    public void setDisplayMessage(String msg) {
        this.message = msg + "(code:" + code + ")";
    }
}
