-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved error reporting a bit, moved all error classes to .error pac…
…kage
- Loading branch information
1 parent
66d126f
commit c77bccc
Showing
35 changed files
with
229 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/dev/latvian/mods/kubejs/error/EmptyTagException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.latvian.mods.kubejs.error; | ||
|
||
import net.minecraft.tags.TagKey; | ||
|
||
public class EmptyTagException extends KubeRuntimeException { | ||
public final TagKey<?> tagKey; | ||
|
||
public EmptyTagException(TagKey<?> tagKey) { | ||
super("Empty tag: " + tagKey.location()); | ||
this.tagKey = tagKey; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/dev/latvian/mods/kubejs/error/EmptyTagTargetException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.latvian.mods.kubejs.error; | ||
|
||
public class EmptyTagTargetException extends KubeRuntimeException { | ||
public EmptyTagTargetException(String message) { | ||
super(message); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/dev/latvian/mods/kubejs/error/KubeRuntimeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package dev.latvian.mods.kubejs.error; | ||
|
||
import dev.latvian.mods.kubejs.script.SourceLine; | ||
import dev.latvian.mods.kubejs.util.MutedError; | ||
|
||
public class KubeRuntimeException extends RuntimeException implements MutedError { | ||
public SourceLine sourceLine; | ||
|
||
public KubeRuntimeException(String m) { | ||
super(m); | ||
this.sourceLine = SourceLine.UNKNOWN; | ||
} | ||
|
||
public KubeRuntimeException(String m, Throwable cause) { | ||
super(m, cause); | ||
this.sourceLine = SourceLine.UNKNOWN; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
var sb = new StringBuilder(); | ||
sb.append(getMessage()); | ||
|
||
// append cause as well since RecipeExceptions can swallow underlying problems | ||
if (getCause() != null) { | ||
sb.append("\ncause: "); | ||
sb.append(getCause()); | ||
} | ||
|
||
return sb.toString(); | ||
} | ||
|
||
public KubeRuntimeException source(SourceLine sourceLine) { | ||
this.sourceLine = sourceLine; | ||
return this; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/dev/latvian/mods/kubejs/error/LegacyError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.latvian.mods.kubejs.error; | ||
|
||
public class LegacyError extends KubeRuntimeException { | ||
public LegacyError(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getLocalizedMessage(); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
.../component/MissingComponentException.java → ...bejs/error/MissingComponentException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/dev/latvian/mods/kubejs/error/UnknownRecipeTypeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.latvian.mods.kubejs.error; | ||
|
||
public class UnknownRecipeTypeException extends KubeRuntimeException { | ||
public final String recipeType; | ||
|
||
public UnknownRecipeTypeException(String recipeType) { | ||
super("Unknown recipe type: " + recipeType); | ||
this.recipeType = recipeType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/main/java/dev/latvian/mods/kubejs/item/EmptyItemError.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
src/main/java/dev/latvian/mods/kubejs/recipe/MissingRecipeFunctionException.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/main/java/dev/latvian/mods/kubejs/recipe/RecipeExceptionJS.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.