diff --git a/src/main/java/seedu/cafectrl/storage/Decoder.java b/src/main/java/seedu/cafectrl/storage/Decoder.java index 5df4e95e78..4368ea1bb1 100644 --- a/src/main/java/seedu/cafectrl/storage/Decoder.java +++ b/src/main/java/seedu/cafectrl/storage/Decoder.java @@ -107,7 +107,7 @@ public static Pantry decodePantryStockData(ArrayList encodedPantryStock) logger.info("Line to decode: " + encodedData); String[] decodedData = encodedData.split(DIVIDER); if (!isValidPantryStockFormat(decodedData)) { - ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA); + ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA + encodedData); continue; } String ingredientName = decodedData[0].trim(); @@ -120,7 +120,7 @@ public static Pantry decodePantryStockData(ArrayList encodedPantryStock) qty = Integer.parseInt(qtyText); } catch (NumberFormatException e) { logger.log(Level.WARNING, "Line corrupted: " + e.getMessage(), e); - ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA); + ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA + encodedData); continue; } @@ -131,8 +131,8 @@ && isValidUnit(unit)) { ingredient = new Ingredient(ingredientName, qty, unit); pantryStock.add(ingredient); } else { - logger.info(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA); - ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA); + logger.info(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA + encodedData); + ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA + encodedData); } } return new Pantry(ui, pantryStock); diff --git a/src/main/java/seedu/cafectrl/ui/ErrorMessages.java b/src/main/java/seedu/cafectrl/ui/ErrorMessages.java index 82951c9474..b318e35390 100644 --- a/src/main/java/seedu/cafectrl/ui/ErrorMessages.java +++ b/src/main/java/seedu/cafectrl/ui/ErrorMessages.java @@ -55,8 +55,8 @@ public class ErrorMessages { + "a new data folder has been created."; public static final String DISH_NOT_FOUND = "I'm sorry, but it appears that dish is so exclusive " + "it hasn't even made it to our menu yet!"; - public static final String ERROR_IN_PANTRY_STOCK_DATA = "Error in pantry stock data file! " - + "Skipping this particular ingredient!"; + public static final String ERROR_IN_PANTRY_STOCK_DATA = "pantry_stock.txt: Invalid format, " + + "this pantry stock will be removed -> "; public static final String UNIT_NOT_MATCHING = ": Sorry, you have used a " + "different unit for this ingredient!" + "\nUnit used previously: ";