Initial commit
This commit is contained in:
63
sources/com/ubt/jimu/base/http/ApiResultException.java
Normal file
63
sources/com/ubt/jimu/base/http/ApiResultException.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.ubt.jimu.base.http;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ApiResultException extends RuntimeException {
|
||||
public static final int CODE_NET_WORK_ERROR = -1;
|
||||
public static final int CODE_SYS_ERROR = -2;
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
public ApiResultException(int i, String str) {
|
||||
this.code = i;
|
||||
this.message = str;
|
||||
}
|
||||
|
||||
public static String codeToMessage(Context context, int i) {
|
||||
if (i == -1) {
|
||||
return context.getString(R.string.network_error);
|
||||
}
|
||||
if (i == 2011) {
|
||||
return context.getString(R.string.error_phone_format);
|
||||
}
|
||||
if (i == 2018) {
|
||||
return context.getString(R.string.error_user_exist);
|
||||
}
|
||||
if (i == 2019) {
|
||||
return context.getString(R.string.error_get_captcha);
|
||||
}
|
||||
switch (i) {
|
||||
case 2002:
|
||||
return context.getString(R.string.error_username_password);
|
||||
case 2003:
|
||||
return context.getString(R.string.error_user_exist);
|
||||
case 2004:
|
||||
return context.getString(R.string.error_user_not_found);
|
||||
case 2005:
|
||||
return context.getString(R.string.error_captcha);
|
||||
case 2006:
|
||||
return context.getString(R.string.error_account_captcha);
|
||||
default:
|
||||
return context.getString(R.string.error_system_later_try) + " (code: " + i + ")";
|
||||
}
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public void setCode(int i) {
|
||||
this.code = i;
|
||||
}
|
||||
|
||||
public void setMessage(String str) {
|
||||
this.message = str;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user