Skip to content

Commit 5adb26c

Browse files
committed
Tweak error messages when annotations are enabled
1 parent 10704c3 commit 5adb26c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ minecraft_version=1.20.4
88
loader_version=0.15.0
99

1010
# Mod Properties
11-
mod_version=1.6.0-beta2
11+
mod_version=1.6.0-beta3
1212
maven_group=io.github.misode
1313
archives_base_name=packtest
1414

src/main/java/io/github/misode/packtest/LoadDiagnostics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void error(Logger logger, String resource, String id, String messa
1414
if (PackTest.isAnnotationsEnabled()) {
1515
annotation = "\n::error title=Failed to load " + resource + " " + id + "::" + message;
1616
}
17-
logger.info(PackTest.wrapError("Failed to load {} {} - {}") + annotation, resource, id, message);
17+
logger.info(PackTest.wrapError("Failed to load {} {}" + (PackTest.isAnnotationsEnabled() ? "" : " - {}")) + annotation, resource, id, message);
1818
}
1919

2020
public static List<Diagnostic> loadErrors() {

src/main/java/io/github/misode/packtest/mixin/LogTestReporterMixin.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ private void onTestFailed(GameTestInfo info, CallbackInfo ci) {
3232
String lineNumber = info.getError() instanceof LineNumberException err
3333
? " on line " + err.getLineNumber()
3434
: "";
35-
String annotation = "";
36-
if (PackTest.isAnnotationsEnabled() && info.isRequired()) {
37-
annotation = "\n::error title=Test " + info.getTestName() + " failed" + lineNumber + "!::" + Util.describeError(info.getError());
38-
}
3935
if (info.isRequired()) {
40-
LOGGER.error(PackTest.wrapError("{} failed{}! {}") + annotation, info.getTestName(), lineNumber, Util.describeError(info.getError()));
36+
String annotation = "";
37+
if (PackTest.isAnnotationsEnabled()) {
38+
annotation = "\n::error title=Test " + info.getTestName() + " failed" + lineNumber + "!::" + Util.describeError(info.getError());
39+
}
40+
LOGGER.error(PackTest.wrapError("{} failed{}!" + (PackTest.isAnnotationsEnabled() ? "" : " {}")) + annotation, info.getTestName(), lineNumber, Util.describeError(info.getError()));
4141
} else {
42-
LOGGER.warn(PackTest.wrapWarning("(optional) {} failed{}! {}") + annotation, info.getTestName(), lineNumber, Util.describeError(info.getError()));
42+
LOGGER.warn(PackTest.wrapWarning("(optional) {} failed{}! {}"), info.getTestName(), lineNumber, Util.describeError(info.getError()));
4343
}
4444
ci.cancel();
4545
}

0 commit comments

Comments
 (0)