Add bakeTime to BurntException

This commit is contained in:
Trophonix
2017-06-21 09:26:17 -05:00
parent b0b434b614
commit 59e7da2dbb
2 changed files with 3 additions and 3 deletions

View File

@@ -9,8 +9,8 @@ public class BurntException extends Exception {
super("Potato is badly burnt by trying to boil it at " + degrees + " degrees!!"); super("Potato is badly burnt by trying to boil it at " + degrees + " degrees!!");
} }
public BurntException() { public BurntException(long bakeTime) {
super("Potato is badly burnt by baking for too long!"); super("Potato is badly burnt by baking for too long!! (" + bakeTime + "ms)");
} }
} }

View File

@@ -86,7 +86,7 @@ public class Potato implements Tuber {
connection.connect(); connection.connect();
int inOven = connection.getResponseCode(); int inOven = connection.getResponseCode();
long bakeTime = (System.currentTimeMillis() - begin); long bakeTime = (System.currentTimeMillis() - begin);
if (bakeTime > 1100) throw new BurntException(); if (bakeTime > 1100) throw new BurntException(bakeTime);
return inOven == 200; return inOven == 200;
} catch (IOException ex) { } catch (IOException ex) {
throw new OvenException(ex); throw new OvenException(ex);