diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-10-06 19:26:52 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-10-06 19:26:52 -0400 |
| commit | a7a87f682a039d4761112f1dedb9351f3d7a2bbf (patch) | |
| tree | 14688fcc9f8f0d8dee718e213ba5725a7ddc2db1 /base/src/main/java/bjc/utils/ioutils | |
| parent | 9dd6cd76e45335f5d303456a648c3eca9c5bf930 (diff) | |
Rename exceptions to not use Exception
This renames several of the stock exceptions to remove 'Exception' from
their name. This is something that I don't recall where I picked it up
from, but the idea is that the fact that it is an exception is generally
syntactically obvious. Therefore, you can instead give your exceptions
names which directly state what it wrong, as well as strongly implying
what you can do to fix it.
For instance, if you get a DirectionInvalid, it is apparent what the
issue is (it is less apparent why it is invalid, but that is another
issue, and a discussion for another time)
Diffstat (limited to 'base/src/main/java/bjc/utils/ioutils')
| -rw-r--r-- | base/src/main/java/bjc/utils/ioutils/RuleBasedConfigReader.java | 4 | ||||
| -rw-r--r-- | base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/base/src/main/java/bjc/utils/ioutils/RuleBasedConfigReader.java b/base/src/main/java/bjc/utils/ioutils/RuleBasedConfigReader.java index fe303f3..2ce2591 100644 --- a/base/src/main/java/bjc/utils/ioutils/RuleBasedConfigReader.java +++ b/base/src/main/java/bjc/utils/ioutils/RuleBasedConfigReader.java @@ -10,7 +10,7 @@ import bjc.data.IHolder; import bjc.data.IPair; import bjc.data.Identity; import bjc.data.Pair; -import bjc.utils.exceptions.UnknownPragmaException; +import bjc.utils.exceptions.UnknownPragma; import bjc.funcdata.FunctionalMap; import bjc.funcdata.FunctionalStringTokenizer; import bjc.funcdata.IMap; @@ -271,7 +271,7 @@ public class RuleBasedConfigReader<E> { * Handle pragmas */ pragmas.getOrDefault(token, (tokenzer, stat) -> { - throw new UnknownPragmaException("Unknown pragma " + token); + throw new UnknownPragma("Unknown pragma " + token); }).accept(tokenizer, state); } else { /* diff --git a/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java b/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java index 42a01a4..535b3d4 100644 --- a/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java +++ b/base/src/main/java/bjc/utils/ioutils/RuleBasedReaderPragmas.java @@ -2,7 +2,7 @@ package bjc.utils.ioutils; import java.util.function.BiConsumer; -import bjc.utils.exceptions.PragmaFormatException; +import bjc.utils.exceptions.BadPragmaFormat; import bjc.funcdata.FunctionalStringTokenizer; import bjc.utils.funcutils.ListUtils; @@ -35,7 +35,7 @@ public class RuleBasedReaderPragmas { if (!tokenizer.hasMoreTokens()) { String fmt = "Pragma %s requires one integer argument"; - throw new PragmaFormatException(String.format(fmt, name)); + throw new BadPragmaFormat(String.format(fmt, name)); } /* @@ -55,8 +55,8 @@ public class RuleBasedReaderPragmas { String fmt = "Argument %s to %s pragma isn't a valid integer, and this pragma requires an integer argument."; - final PragmaFormatException pfex - = new PragmaFormatException(String.format(fmt, token, name)); + final BadPragmaFormat pfex + = new BadPragmaFormat(String.format(fmt, token, name)); pfex.initCause(nfex); @@ -87,7 +87,7 @@ public class RuleBasedReaderPragmas { if (!tokenizer.hasMoreTokens()) { String fmt = "Pragma %s requires one or more string arguments."; - throw new PragmaFormatException(String.format(fmt, name)); + throw new BadPragmaFormat(String.format(fmt, name)); } /* |
