|  |  |  | 
|---|
|  |  |  | const errorInfo: ErrorInfo | undefined = (error as any).info; | 
|---|
|  |  |  | if (errorInfo) { | 
|---|
|  |  |  | const { errorMessage, errorCode } = errorInfo; | 
|---|
|  |  |  | if (Number(errorCode) === 401) { | 
|---|
|  |  |  | handleLogout(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | switch (errorInfo.showType) { | 
|---|
|  |  |  | case ErrorShowType.SILENT: | 
|---|
|  |  |  | // do nothing | 
|---|
|  |  |  | 
|---|
|  |  |  | } else if ((error as AxiosError<ResponseStructure, IRequestOptions>).response) { | 
|---|
|  |  |  | // Axios 的错误 | 
|---|
|  |  |  | // 请求成功发出且服务器也响应了状态码,但状态代码超出了 2xx 的范围 | 
|---|
|  |  |  | handleAxiosResponseError(error as AxiosError<ErrorResponse, IRequestOptions>); | 
|---|
|  |  |  | handleAxiosResponseError(error as AxiosError<ResponseStructure, IRequestOptions>); | 
|---|
|  |  |  | // Message.errorMessage(`Response status:${(error as AxiosError).response.status}`); | 
|---|
|  |  |  | } else if ((error as AxiosError).request) { | 
|---|
|  |  |  | // 请求已经成功发起,但没有收到响应 | 
|---|