From a7a87f682a039d4761112f1dedb9351f3d7a2bbf Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Tue, 6 Oct 2020 19:26:52 -0400 Subject: 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) --- base/src/main/java/bjc/utils/misc/Direction.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'base/src/main/java/bjc/utils/misc/Direction.java') diff --git a/base/src/main/java/bjc/utils/misc/Direction.java b/base/src/main/java/bjc/utils/misc/Direction.java index 6455d8d..cc24b49 100644 --- a/base/src/main/java/bjc/utils/misc/Direction.java +++ b/base/src/main/java/bjc/utils/misc/Direction.java @@ -5,7 +5,7 @@ import java.util.function.Consumer; import org.apache.commons.lang3.text.WordUtils; -import bjc.utils.exceptions.InvalidDirectionException; +import bjc.utils.exceptions.DirectionInvalid; import bjc.funcdata.FunctionalList; import bjc.funcdata.IList; @@ -122,7 +122,7 @@ public enum Direction { case UP: return false; default: - throw new InvalidDirectionException( + throw new DirectionInvalid( "WAT. Somehow ended up with an invalid direction " + this); } } @@ -171,7 +171,7 @@ public enum Direction { case UP: case DOWN: default: - throw new InvalidDirectionException( + throw new DirectionInvalid( "Can't rotate non-cardinal direction clockwise: " + this); } @@ -197,7 +197,7 @@ public enum Direction { case UP: case DOWN: default: - throw new InvalidDirectionException( + throw new DirectionInvalid( "Can't rotate non-cardinal direction counterclockwise: " + this); } -- cgit v1.2.3