From 208af6ce9c16f7c1b4bc93937fd7abc1bf217ba1 Mon Sep 17 00:00:00 2001 From: TheRealMaxion Date: Wed, 16 Mar 2022 12:08:00 +0100 Subject: [PATCH] Fix some misleading corporation errors --- src/Corporation/Actions.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index ab217d843..03f937e08 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -119,17 +119,17 @@ export function SellMaterial(mat: Material, amt: string, price: string): void { try { tempQty = eval(tempQty); } catch (e) { - throw new Error("Invalid value or expression for sell price field: " + e); + throw new Error("Invalid value or expression for sell quantity field: " + e); } if (tempQty == null || isNaN(parseFloat(tempQty)) || parseFloat(tempQty) < 0) { - throw new Error("Invalid value or expression for sell price field"); + throw new Error("Invalid value or expression for sell quantity field"); } mat.sllman[0] = true; mat.sllman[1] = q; //Use sanitized input } else if (isNaN(parseFloat(amt)) || parseFloat(amt) < 0) { - throw new Error("Invalid value for sell quantity field! Must be numeric or 'MAX'"); + throw new Error("Invalid value for sell quantity field! Must be numeric or 'PROD' or 'MAX'"); } else { let q = parseFloat(amt); if (isNaN(q)) { @@ -156,10 +156,10 @@ export function SellProduct(product: Product, city: string, amt: string, price: try { temp = eval(temp); } catch (e) { - throw new Error("Invalid value or expression for sell quantity field: " + e); + throw new Error("Invalid value or expression for sell price field: " + e); } if (temp == null || isNaN(parseFloat(temp)) || parseFloat(temp) < 0) { - throw new Error("Invalid value or expression for sell quantity field."); + throw new Error("Invalid value or expression for sell price field."); } product.sCost = price; //Use sanitized price } else { @@ -184,11 +184,11 @@ export function SellProduct(product: Product, city: string, amt: string, price: try { temp = eval(temp); } catch (e) { - throw new Error("Invalid value or expression for sell price field: " + e); + throw new Error("Invalid value or expression for sell quantity field: " + e); } if (temp == null || isNaN(parseFloat(temp)) || parseFloat(temp) < 0) { - throw new Error("Invalid value or expression for sell price field"); + throw new Error("Invalid value or expression for sell quantity field"); } if (all) { for (let i = 0; i < cities.length; ++i) { @@ -201,7 +201,7 @@ export function SellProduct(product: Product, city: string, amt: string, price: product.sllman[city][1] = qty; //Use sanitized input } } else if (isNaN(parseFloat(amt)) || parseFloat(amt) < 0) { - throw new Error("Invalid value for sell quantity field! Must be numeric"); + throw new Error("Invalid value for sell quantity field! Must be numeric or 'PROD' or 'MAX'"); } else { let qty = parseFloat(amt); if (isNaN(qty)) {