diff options
| author | jantuomi <jans.tuomi@gmail.com> | 2016-08-03 09:31:36 +0300 |
|---|---|---|
| committer | jantuomi <jans.tuomi@gmail.com> | 2016-08-03 09:54:46 +0300 |
| commit | 30d3ce8402015db2a85a4bed35a20bd95bd0c283 (patch) | |
| tree | 36ff5d63adec2eb2c4f0e169f98de8f09a5a2d21 /src/main/com/jantuomi/tunkki/exception | |
| parent | 1f41c228222cd3dcd4f746fc9dc1aeffa224fde8 (diff) | |
Add FileNotFoundError, OutOfBoundsError, RecursiveIncludeError
Change several GeneralError throws to utilize new error types
Diffstat (limited to 'src/main/com/jantuomi/tunkki/exception')
4 files changed, 62 insertions, 1 deletions
diff --git a/src/main/com/jantuomi/tunkki/exception/types/FileNotFoundTunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/FileNotFoundTunkkiError.java new file mode 100644 index 0000000..6bd60d6 --- /dev/null +++ b/src/main/com/jantuomi/tunkki/exception/types/FileNotFoundTunkkiError.java @@ -0,0 +1,20 @@ +package com.jantuomi.tunkki.exception.types; + +/** + * Created by jan on 3.8.2016. + */ +public class FileNotFoundTunkkiError extends TunkkiError { + public FileNotFoundTunkkiError(int line, String... args) { + super(line, args); + } + + @Override + public String what() { + return "File %s could not be found."; + } + + @Override + ExceptionType getType() { + return ExceptionType.FileNotFoundError; + } +} diff --git a/src/main/com/jantuomi/tunkki/exception/types/OutOfBoundsTunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/OutOfBoundsTunkkiError.java new file mode 100644 index 0000000..16c30ae --- /dev/null +++ b/src/main/com/jantuomi/tunkki/exception/types/OutOfBoundsTunkkiError.java @@ -0,0 +1,20 @@ +package com.jantuomi.tunkki.exception.types; + +/** + * Created by jan on 3.8.2016. + */ +public class OutOfBoundsTunkkiError extends TunkkiError { + public OutOfBoundsTunkkiError(int line, String... args) { + super(line, args); + } + + @Override + public String what() { + return "Index %s is out of bounds."; + } + + @Override + ExceptionType getType() { + return ExceptionType.OutOfBoundsError; + } +} diff --git a/src/main/com/jantuomi/tunkki/exception/types/RecursiveIncludeTunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/RecursiveIncludeTunkkiError.java new file mode 100644 index 0000000..3cb359d --- /dev/null +++ b/src/main/com/jantuomi/tunkki/exception/types/RecursiveIncludeTunkkiError.java @@ -0,0 +1,20 @@ +package com.jantuomi.tunkki.exception.types; + +/** + * Created by jan on 3.8.2016. + */ +public class RecursiveIncludeTunkkiError extends TunkkiError { + public RecursiveIncludeTunkkiError(int line, String... args) { + super(line, args); + } + + @Override + public String what() { + return "Recursive include with module name '%s' detected."; + } + + @Override + ExceptionType getType() { + return ExceptionType.RecursiveIncludeError; + } +} diff --git a/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java b/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java index 62c2114..c99e8f9 100644 --- a/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java +++ b/src/main/com/jantuomi/tunkki/exception/types/TunkkiError.java @@ -22,7 +22,8 @@ abstract public class TunkkiError extends Exception { GeneralError, CastError, DivisionByZeroError, - NadaError + RecursiveIncludeError, + OutOfBoundsError, FileNotFoundError, NadaError } private int line; |
