diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/throwables')
3 files changed, 0 insertions, 85 deletions
diff --git a/src/main/java/cuchaz/enigma/throwables/IllegalNameException.java b/src/main/java/cuchaz/enigma/throwables/IllegalNameException.java deleted file mode 100644 index 0155ad2..0000000 --- a/src/main/java/cuchaz/enigma/throwables/IllegalNameException.java +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.throwables; | ||
| 13 | |||
| 14 | public class IllegalNameException extends RuntimeException { | ||
| 15 | |||
| 16 | private String name; | ||
| 17 | private String reason; | ||
| 18 | |||
| 19 | public IllegalNameException(String name, String reason) { | ||
| 20 | this.name = name; | ||
| 21 | this.reason = reason; | ||
| 22 | } | ||
| 23 | |||
| 24 | public String getReason() { | ||
| 25 | return this.reason; | ||
| 26 | } | ||
| 27 | |||
| 28 | @Override | ||
| 29 | public String getMessage() { | ||
| 30 | StringBuilder buf = new StringBuilder(); | ||
| 31 | buf.append("Illegal name: "); | ||
| 32 | buf.append(this.name); | ||
| 33 | if (this.reason != null) { | ||
| 34 | buf.append(" because "); | ||
| 35 | buf.append(this.reason); | ||
| 36 | } | ||
| 37 | return buf.toString(); | ||
| 38 | } | ||
| 39 | } | ||
diff --git a/src/main/java/cuchaz/enigma/throwables/MappingConflict.java b/src/main/java/cuchaz/enigma/throwables/MappingConflict.java deleted file mode 100644 index 95cd449..0000000 --- a/src/main/java/cuchaz/enigma/throwables/MappingConflict.java +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | package cuchaz.enigma.throwables; | ||
| 2 | |||
| 3 | public class MappingConflict extends Exception { | ||
| 4 | public MappingConflict(String clazz, String name, String nameExisting) { | ||
| 5 | super(String.format("Conflicting mappings found for %s. The mapping file is %s and the second is %s", clazz, name, nameExisting)); | ||
| 6 | } | ||
| 7 | } | ||
diff --git a/src/main/java/cuchaz/enigma/throwables/MappingParseException.java b/src/main/java/cuchaz/enigma/throwables/MappingParseException.java deleted file mode 100644 index b7e6d42..0000000 --- a/src/main/java/cuchaz/enigma/throwables/MappingParseException.java +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.throwables; | ||
| 13 | |||
| 14 | import java.io.File; | ||
| 15 | import java.util.function.Supplier; | ||
| 16 | |||
| 17 | public class MappingParseException extends Exception { | ||
| 18 | |||
| 19 | private int line; | ||
| 20 | private String message; | ||
| 21 | private String filePath; | ||
| 22 | |||
| 23 | public MappingParseException(File file, int line, String message) { | ||
| 24 | this.line = line; | ||
| 25 | this.message = message; | ||
| 26 | filePath = file.getAbsolutePath(); | ||
| 27 | } | ||
| 28 | |||
| 29 | public MappingParseException(Supplier<String> filenameProvider, int line, String message) { | ||
| 30 | this.line = line; | ||
| 31 | this.message = message; | ||
| 32 | filePath = filenameProvider.get(); | ||
| 33 | } | ||
| 34 | |||
| 35 | @Override | ||
| 36 | public String getMessage() { | ||
| 37 | return "Line " + line + ": " + message + " in file " + filePath; | ||
| 38 | } | ||
| 39 | } | ||