feat: log error when minio error
This commit is contained in:
parent
dbf5ecfe4a
commit
0a9d3002a4
1 changed files with 8 additions and 2 deletions
|
|
@ -29,7 +29,10 @@ export async function listFile(path: string) {
|
|||
|
||||
stream.on("data", (v) => v && v.name && item.push(v.name.split("/").at(-1) || ""));
|
||||
stream.on("end", () => resolve(item));
|
||||
stream.on("error", () => reject(new Error("MinIO error.")));
|
||||
stream.on("error", (e) => {
|
||||
console.error(e);
|
||||
reject(new Error("MinIO error."));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +60,10 @@ export async function deleteFolder(path: string) {
|
|||
|
||||
stream.on("data", (v) => v && v.name && item.push(v.name));
|
||||
stream.on("end", () => resolve(item));
|
||||
stream.on("error", () => reject(new Error("MinIO error.")));
|
||||
stream.on("error", (e) => {
|
||||
console.error(e);
|
||||
reject(new Error("MinIO error."));
|
||||
});
|
||||
}).then((list) => {
|
||||
list.map(async (v) => {
|
||||
await minio.removeObject(MINIO_BUCKET, v, { forceDelete: true });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue