export interface PlainObject { [key: string]: any } export class APIError extends Error { public code: number public response: PlainObject public type?: string constructor(message = '未知错误', resData: PlainObject) { super(message) this.name = 'APIError' this.code = Number(resData.code) this.response = resData } } export class HttpError extends Error { public code: number public response: PlainObject public type?: string constructor(message = '网络连接错误,请稍后再试', resData: PlainObject) { super(message) this.name = 'HttpError' this.code = resData.code this.response = resData } }