diff options
author | zaaarf <zaaarf@proton.me> | 2023-08-26 18:09:36 +0200 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-08-26 18:09:52 +0200 |
commit | 7898882bc5811e5f06e70bc2bb6925e114869a56 (patch) | |
tree | ee2f2a4f75c72f4beaead402d7cbf2ad8d71bfe0 /src/main/java/ftbsc/lll/exceptions | |
parent | c3cc90d7743b18aaef0d22adb7292c63ef48603f (diff) |
feat: implemented abstraction logic
Diffstat (limited to 'src/main/java/ftbsc/lll/exceptions')
3 files changed, 33 insertions, 12 deletions
diff --git a/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java b/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java new file mode 100644 index 0000000..060d57c --- /dev/null +++ b/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java @@ -0,0 +1,23 @@ +package ftbsc.lll.exceptions; + +/** + * Thrown when a resource passed as an argument is not found. + */ +public class InvalidResourceException extends RuntimeException { + + /** + * Empty constructor, used when the provided resource exists but no + * mapper was able to read it. + */ + public InvalidResourceException() { + super("The given resource was not claimed by any mapper!"); + } + + /** + * Named constructor, used when the specified resource doesn't exist. + * @param name the resource name + */ + public InvalidResourceException(String name) { + super(String.format("Specified resource %s was not found!", name)); + } +} diff --git a/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java b/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java new file mode 100644 index 0000000..1352855 --- /dev/null +++ b/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java @@ -0,0 +1,7 @@ +package ftbsc.lll.exceptions; + +public class MalformedMappingsException extends Exception { + public MalformedMappingsException(String mapping, String type) { + super(String.format("Unexpected token at line %s for mapper type %s!", mapping, type)); + } +} diff --git a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java index 6c286fc..85ac08f 100644 --- a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java +++ b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java @@ -9,19 +9,10 @@ public class MappingNotFoundException extends RuntimeException { /** * Constructs a new mapping not found exception for the specified mapping. + * @param type the type of mapping * @param mapping the relevant mapping */ - public MappingNotFoundException(String mapping) { - super(String.format("Could not find mapping for %s!", mapping)); - } - - /** - * Constructs a new mapping not found exception for the specified mapping - * with the specified reason. - * @param mapping the relevant mapping - * @param reason the reason message - */ - public MappingNotFoundException(String mapping, String reason) { - this(mapping + ": " + reason); + public MappingNotFoundException(String type, String mapping) { + super(String.format("Could not find mapping for %s %s!", type, mapping)); } } |