forked from nus-cs2103-AY2425S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/yadobler/ip
- Loading branch information
Showing
17 changed files
with
233 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/yappingbot/exceptions/YappingBotExceptionList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package yappingbot.exceptions; | ||
|
||
import java.util.ArrayList; | ||
|
||
import yappingbot.stringconstants.ReplyTextMessages; | ||
|
||
/** | ||
* Array container for multiple YappingBotExceptions that are to be collected and thrown together | ||
* at the end. | ||
*/ | ||
public class YappingBotExceptionList extends ArrayList<YappingBotException> { | ||
|
||
/** | ||
* Checks if any exceptions were added, and collates them into a single generic | ||
* YappingBotException. | ||
* | ||
* @throws YappingBotException only if exceptions are present and added. | ||
*/ | ||
public void checkExceptions() throws YappingBotException { | ||
if (!isEmpty()) { | ||
StringBuilder sb = new StringBuilder(); | ||
for (YappingBotException e : this) { | ||
sb.append(e.getErrorMessage()); | ||
sb.append("\n---\n"); | ||
} | ||
throw new YappingBotException(String.format( | ||
ReplyTextMessages.MULTIPLE_EXCEPTIONS_1d_1s, | ||
this.size(), | ||
sb | ||
)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/main/java/yappingbot/exceptions/YappingBotOobException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.