Clear console and properly handle error message when querying database or containers (#1679)

This commit is contained in:
Laurent Nguyen
2023-10-26 15:55:48 +00:00
committed by GitHub
parent 3a703b0bd0
commit 661f6f4bfb
2 changed files with 22 additions and 7 deletions

View File

@@ -35,14 +35,21 @@ export async function readCollections(databaseId: string): Promise<DataModels.Co
}
}
const responses = await Promise.all(promises);
responses.forEach((response) => {
collections.push(response.resource as DataModels.Collection);
});
try {
const responses = await Promise.all(promises);
responses.forEach((response) => {
collections.push(response.resource as DataModels.Collection);
});
// Sort collections by id before returning
collections.sort((a, b) => a.id.localeCompare(b.id));
return collections;
// Sort collections by id before returning
collections.sort((a, b) => a.id.localeCompare(b.id));
return collections;
} catch (error) {
handleError(error, "ReadCollections", `Error while querying containers for database ${databaseId}`);
throw error;
} finally {
clearMessage();
}
}
try {