Files
weRequest/build/module/catchHandler.d.ts
mwindson 1b36b32282 fix(requestHandler): 修改请求或网络异常时的处理逻辑,避免promise.then中的代码继续执行 (#30)
* 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
2019-07-04 17:47:25 +08:00

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 };