Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
feat: add try catch for assets get
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jun 14, 2022
1 parent d5d4459 commit 255a55c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/assets/index.ts
Expand Up @@ -116,13 +116,20 @@ class Assets {
if (options.providers!.length > 1) {
const list = await Promise.all(
options.providers!.map(async (provider: string, index) => {
const result = await this.map[options.source][provider].get(
Object.assign(options, {
cursor: options.cursor?.[index],
}),
);
this.main.utils.removeEmpty(result.list);
return result;
try {
const result = await this.map[options.source][provider].get(
Object.assign(options, {
cursor: options.cursor?.[index],
}),
);
this.main.utils.removeEmpty(result.list);
return result;
} catch (error) {
return {
total: 0,
list: [],
};
}
}),
);

Expand Down

0 comments on commit 255a55c

Please sign in to comment.