Add base type for exceptions

This commit is contained in:
aNNiMON 2023-09-17 18:46:09 +03:00 committed by Victor Melnik
parent 312a05576c
commit cdf0219ca1
14 changed files with 46 additions and 16 deletions

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class ArgumentsMismatchException extends RuntimeException {
public final class ArgumentsMismatchException extends OwnLangRuntimeException {
public ArgumentsMismatchException() {
}

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class OperationIsNotSupportedException extends RuntimeException {
public final class OperationIsNotSupportedException extends OwnLangRuntimeException {
public OperationIsNotSupportedException(Object operation) {
super("Operation " + operation + " is not supported");

View File

@ -0,0 +1,15 @@
package com.annimon.ownlang.exceptions;
/**
* Base type for all runtime exceptions
*/
public abstract class OwnLangRuntimeException extends RuntimeException {
public OwnLangRuntimeException() {
super();
}
public OwnLangRuntimeException(String message) {
super(message);
}
}

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class PatternMatchingException extends RuntimeException {
public final class PatternMatchingException extends OwnLangRuntimeException {
public PatternMatchingException() {
}

View File

@ -0,0 +1,6 @@
package com.annimon.ownlang.exceptions;
public class StoppedException extends OwnLangRuntimeException {
}

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class TypeException extends RuntimeException {
public final class TypeException extends OwnLangRuntimeException {
public TypeException(String message) {
super(message);

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class UnknownClassException extends RuntimeException {
public final class UnknownClassException extends OwnLangRuntimeException {
private final String className;

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class UnknownFunctionException extends RuntimeException {
public final class UnknownFunctionException extends OwnLangRuntimeException {
private final String functionName;

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class UnknownPropertyException extends RuntimeException {
public final class UnknownPropertyException extends OwnLangRuntimeException {
private final String propertyName;

View File

@ -1,6 +1,6 @@
package com.annimon.ownlang.exceptions;
public final class VariableDoesNotExistsException extends RuntimeException {
public final class VariableDoesNotExistsException extends OwnLangRuntimeException {
private final String variable;

View File

@ -6,7 +6,7 @@ import com.annimon.ownlang.parser.Pos;
*
* @author aNNiMON
*/
public final class LexerException extends RuntimeException {
public final class LexerException extends OwnLangParserException {
public LexerException(String message) {
super(message);

View File

@ -0,0 +1,15 @@
package com.annimon.ownlang.exceptions;
/**
* Base type for all lexer and parser exceptions
*/
public abstract class OwnLangParserException extends RuntimeException {
public OwnLangParserException() {
super();
}
public OwnLangParserException(String message) {
super(message);
}
}

View File

@ -7,7 +7,7 @@ import com.annimon.ownlang.parser.Range;
*
* @author aNNiMON
*/
public final class ParseException extends RuntimeException {
public final class ParseException extends OwnLangParserException {
private final Range range;

View File

@ -1,6 +0,0 @@
package com.annimon.ownlang.exceptions;
public class StoppedException extends RuntimeException {
}