diff --git a/src/errors/index.ts b/src/errors/index.ts index 86d64068..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(message: string, reqId: string = '') { + constructor(reqId = '', 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),