1 package com.foxinmy.weixin4j.wxa.api;
2
3 import java.io.Serializable;
4
5 import com.alibaba.fastjson.TypeReference;
6 import com.foxinmy.weixin4j.exception.WeixinException;
7
8 class WxaApiResult implements Serializable {
9
10 private static final long serialVersionUID = 2018052601L;
11
12 public static final TypeReference<WxaApiResult> TYPE_REFERENCE
13 = new TypeReference<WxaApiResult>() {
14 };
15
16 private int errCode;
17 private String errMsg;
18
19 public WxaApiResult() {
20 }
21
22 public int getErrCode() {
23 return errCode;
24 }
25
26 public void setErrCode(int errCode) {
27 this.errCode = errCode;
28 }
29
30 public String getErrMsg() {
31 return errMsg;
32 }
33
34 public void setErrMsg(String errMsg) {
35 this.errMsg = errMsg;
36 }
37
38 public WeixinException toWeixinException() {
39 return new WeixinException(Integer.toString(errCode), errMsg);
40 }
41
42 public void checkErrCode() throws WeixinException {
43 if (getErrCode() != 0) {
44 throw this.toWeixinException();
45 }
46 }
47
48 }