* fix(requestHandler): 修复请求或网络异常时处理后的response为undefined导致promise.then继续执行的问题 当请求未触发成功条件或statusCode不为200时,responseHandler返回的response为undefined,导致resolve返回并执行promise.then中的代码. 目前通过判断response是否为undefined决定是否resolve(response)来避免break change * fix(request&&uploadFile): 修改responseHandler抛出异常的逻辑并增加捕获异常的处理luoji
9 lines
358 B
TypeScript
9 lines
358 B
TypeScript
import { IRequestOption, IUploadFileOption } from "../interface";
|
|
declare type ThrowErrorType = 'upload-error' | 'logic-error' | 'http-error';
|
|
interface ThrowError {
|
|
type: ThrowErrorType;
|
|
res: any;
|
|
}
|
|
declare function catchHandler(e: ThrowError, obj: IRequestOption | IUploadFileOption, reject: (reason?: any) => void): void;
|
|
export { catchHandler };
|