mirror of
https://github.com/UnlegitDqrk/Potato.git
synced 2025-10-01 22:30:14 +02:00
Add bakeTime to BurntException
This commit is contained in:
@@ -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)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user