package com.ym.admodule.config;

import android.text.TextUtils;

public class AdError {

    public static final int NETWORK_ERROR_CODE = 1000;
    public static final int NO_FILL_ERROR_CODE = 1001;
    public static final int LOAD_TOO_FREQUENTLY_ERROR_CODE = 1002;
    public static final int IMPRESSION_LIMIT_ERROR_CODE = 1003;
    public static final int SERVER_ERROR_CODE = 2000;
    public static final int INTERNAL_ERROR_CODE = 2001;
    public static final int TIME_OUT_CODE = 3000;
    public static final int UNKNOW_ERROR_CODE = 3001;
    public static final int NO_CHANNEL_ERROR_CODE = 3002;
    public static final AdError NETWORK_ERROR = new AdError(NETWORK_ERROR_CODE, "Network Error");
    public static final AdError NO_FILL = new AdError(NO_FILL_ERROR_CODE, "No Fill");
    public static final AdError LOAD_TOO_FREQUENTLY = new AdError(LOAD_TOO_FREQUENTLY_ERROR_CODE, "Ad was re-loaded too frequently");
    public static final AdError SERVER_ERROR = new AdError(SERVER_ERROR_CODE, "Server Error");
    public static final AdError INTERNAL_ERROR = new AdError(INTERNAL_ERROR_CODE, "Internal Error");
    public static final AdError TIME_OUT_ERROR = new AdError(TIME_OUT_CODE, "Time Out");
    public static final AdError UNKNOW_ERROR = new AdError(UNKNOW_ERROR_CODE, "unknow error");
    public static final AdError NO_CHANNEL_ERROR = new AdError(NO_CHANNEL_ERROR_CODE, "no channel error");
    public static final AdError IMPRESSION_LIMIT_ERROR = new AdError(IMPRESSION_LIMIT_ERROR_CODE, "Impression Limit Error");
    private final int errorCode;
    private final String errorMessage;

    public AdError(int paramInt, String paramString) {
        if (TextUtils.isEmpty(paramString))
            paramString = "unknown error";
        this.errorCode = paramInt;
        this.errorMessage = paramString;
    }

    public int getErrorCode() {
        return this.errorCode;
    }

    public String getErrorMessage() {
        return this.errorMessage;
    }

    public static AdError createAdError(int code, String msg) {
        return new AdError(code, msg);
    }
}
