Added Exceptions classes

This commit is contained in:
Ahmad 2024-06-22 16:56:12 +02:00
parent 72733f4612
commit 0e035aac8b
7 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,10 @@
package de.maishai.typedast.ExceptionHandler;
public class FieldAlreadyDeclaredException extends RuntimeException{
public FieldAlreadyDeclaredException(String name) {
super("Field " + name + " already declared");
}
}

View File

@ -0,0 +1,7 @@
package de.maishai.typedast.ExceptionHandler;
public class LocalVariableAlreadDeclaredException extends RuntimeException {
public LocalVariableAlreadDeclaredException(String name){
super("local Variable " + name + " already declared");
}
}

View File

@ -0,0 +1,9 @@
package de.maishai.typedast.ExceptionHandler;
public class NotFoundMethodOrConstructor extends RuntimeException {
public NotFoundMethodOrConstructor() {
super("Method or constructor not found in class");
}
}

View File

@ -0,0 +1,13 @@
package de.maishai.typedast.ExceptionHandler;
public class NotMatchConstructorException extends RuntimeException {
public NotMatchConstructorException(String constructorName) {
super(constructorName);
}
public NotMatchConstructorException() {
super("Not matching constructor found");
}
}

View File

@ -0,0 +1,14 @@
package de.maishai.typedast.ExceptionHandler;
public class ParameterAlreadyExistsException extends RuntimeException{
public ParameterAlreadyExistsException(String paraName) {
super("Parameter '" + paraName + "' already exists");
}
public ParameterAlreadyExistsException(String paraName, String methodOrConstructorName) {
super("Parameter '" + paraName + "' already exists in " + methodOrConstructorName);
}
public ParameterAlreadyExistsException() {
super("Parameter already exists");
}
}

View File

@ -0,0 +1,9 @@
package de.maishai.typedast.ExceptionHandler;
public class TypeMismatchException extends RuntimeException{
public TypeMismatchException(String operator) {
super("Type mismatch in operator: " + operator);
}
}

View File

@ -0,0 +1,13 @@
package de.maishai.typedast.ExceptionHandler;
public class VariableNotDeclaredException extends RuntimeException{
public VariableNotDeclaredException(String variableName) {
super("Variable '" + variableName + "' not declared");
}
public VariableNotDeclaredException(String variableName, String methodName) {
super("Variable '" + variableName + "' not declared in method '" + methodName + "'");
}
}