Skip to content

Commit

Permalink
Add error handling for remote recipe selecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tnze committed Oct 6, 2024
1 parent 3405140 commit 7df0a84
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 8 additions & 1 deletion src/components/recipe-manager/RecipePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ onMounted(async () => {
ElMessage.error($t("datasource-unsupport-recipe-info"));
return;
}
const recipeInfo = await source.recipeInfo(recipeId);
try {
isRecipeTableLoading.value = true;
var recipeInfo = await source.recipeInfo(recipeId);
} catch (e: any) {
ElMessage.error(String(e));
isRecipeTableLoading.value = false;
return;
}
await selectRecipeRow(recipeInfo);
}
});
Expand Down
4 changes: 0 additions & 4 deletions src/components/recipe-manager/local-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export class LocalRecipeSource {
return result
}

async recipeInfo(recipeId: number): Promise<RecipeInfo> {
throw "todo"
}

async itemInfo(itemId: number): Promise<Item> {
const { id, name, level, can_be_hq, category_id } = await (await this.invoke)("item_info", { itemId }) as {
id: number,
Expand Down
4 changes: 0 additions & 4 deletions src/components/recipe-manager/web-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export class WebSource {
return result
}

async recipeInfo(recipeId: number): Promise<RecipeInfo> {
throw "todo"
}

async itemInfo(itemId: number): Promise<Item> {
const query = new URLSearchParams({ 'item_id': String(itemId) })
const url = new URL("item_info", this.base).toString() + '?' + query.toString();
Expand Down

0 comments on commit 7df0a84

Please sign in to comment.