From 121fbd57778982f49cf9a9b45c387e9784dac6a4 Mon Sep 17 00:00:00 2001 From: wxl Date: Thu, 20 May 2021 22:53:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/errors/index.ts | 2 +- src/upload/index.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/errors/index.ts b/src/errors/index.ts index 86d64068..ee05ddce 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -51,7 +51,7 @@ export class QiniuRequestError extends QiniuError { * @description 由于跨域、证书错误、断网、host 解析失败、系统拦截等原因导致的错误 */ export class QiniuNetworkError extends QiniuRequestError { - constructor(message: string, reqId: string = '') { + constructor(reqId: string = '', message: string) { super(0, reqId, message) } } diff --git a/src/upload/index.ts b/src/upload/index.ts index 5e986efd..71b43529 100644 --- a/src/upload/index.ts +++ b/src/upload/index.ts @@ -1,10 +1,10 @@ import Resume from './resume' import Direct from './direct' import Logger from '../logger' -import { QiniuError } from '../errors' +import { QiniuError, QiniuNetworkError, QiniuRequestError } from '../errors' import { UploadCompleteData } from '../api' import { Observable, IObserver, MB, normalizeUploadConfig } from '../utils' -import { Extra, UploadOptions, UploadHandlers, UploadProgress, InternalConfig } from './base' +import { Extra, UploadOptions, UploadHandlers, UploadProgress, Config } from './base' import { HostPool } from './hosts' export * from './base' @@ -43,8 +43,8 @@ export default function upload( key: string | null | undefined, token: string, putExtra?: Partial, - config?: Partial -): Observable { + config?: Config +): Observable { // 为每个任务创建单独的 Logger const logger = new Logger(token, config?.disableStatisticsReport, config?.debugLogLevel, file.name) @@ -60,7 +60,7 @@ export default function upload( // 创建 host 池 const hostPool = new HostPool(options.config.uphost) - return new Observable((observer: IObserver) => { + return new Observable((observer: IObserver) => { const manager = createUploadManager(options, { onData: (data: UploadProgress) => observer.next(data), onError: (err: QiniuError) => observer.error(err), From 20cbd6c387ae216dd778d5adc9f08b1b8e5ccc31 Mon Sep 17 00:00:00 2001 From: Wxl <84518559+wangxuling@users.noreply.github.com> Date: Fri, 21 May 2021 09:54:49 +0800 Subject: [PATCH 2/2] Update src/errors/index.ts Co-authored-by: Alain --- src/errors/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/errors/index.ts b/src/errors/index.ts index ee05ddce..7769d131 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -51,7 +51,7 @@ export class QiniuRequestError extends QiniuError { * @description 由于跨域、证书错误、断网、host 解析失败、系统拦截等原因导致的错误 */ export class QiniuNetworkError extends QiniuRequestError { - constructor(reqId: string = '', message: string) { + constructor(reqId = '', message: string) { super(0, reqId, message) } }