From 4bb03ae5ba7363be667b4e595dd5cf8ea4af8669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 14 Nov 2024 12:22:28 +0800 Subject: [PATCH] fix --- src/core/packet/highway/uploader/highwayHttpUploader.ts | 6 +++--- src/core/packet/utils/crypto/hash.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/packet/highway/uploader/highwayHttpUploader.ts b/src/core/packet/highway/uploader/highwayHttpUploader.ts index a3411b90..962261a2 100644 --- a/src/core/packet/highway/uploader/highwayHttpUploader.ts +++ b/src/core/packet/highway/uploader/highwayHttpUploader.ts @@ -64,11 +64,11 @@ export class HighwayHttpUploader extends IHighwayUploader { }); }); req.write(frame); - req.on('error', (error) => { + req.on('error', (error: Error) => { reject(error); }); - } catch (error) { - reject(error); + } catch (error: unknown) { + reject(new Error((error as Error).message)); } }); } diff --git a/src/core/packet/utils/crypto/hash.ts b/src/core/packet/utils/crypto/hash.ts index 56ab7524..39a3b925 100644 --- a/src/core/packet/utils/crypto/hash.ts +++ b/src/core/packet/utils/crypto/hash.ts @@ -39,7 +39,7 @@ export function calculateSha1StreamBytes(filePath: string): Promise { calculateStreamBytes.on('end', () => { resolve(byteArrayList); }); - calculateStreamBytes.on('error', (err) => { + calculateStreamBytes.on('error', (err: Error) => { reject(err); }); readable.pipe(calculateStreamBytes);