XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

chore: improve response when there's insufficient credits for recipe (#3909)

U7/U8 don't seem to check credits before sending the request. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3909 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

94f10ed6
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +7 -1
Modified src/controllers/api/startRecipeController.ts +7 -1
@@ -45,7 +45,13 @@ export const startRecipeController: RequestHandler = async (req, res) => {
45 45 }
46 46
47 47 const inventory = await getInventory(account._id);
48 updateCurrency(inventory, recipe.buildPrice, false);
48 try {
49 updateCurrency(inventory, recipe.buildPrice, false);
50 } catch (e) {
51 logger.error((e as Error).message);
52 res.status(400).json(1); // "Insufficient credits"
53 return;
54 }
49 55
50 56 const pr =
51 57 inventory.PendingRecipes[