From b08c48f2a3efd13260efb913f11effd3a6b3a359 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 9 Oct 2021 22:29:01 +0800 Subject: Make SearchProviderImpl crash with more details --- .../rei/impl/client/search/SearchProviderImpl.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'runtime/src/main/java') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/SearchProviderImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/SearchProviderImpl.java index 530bfa266..0112ca363 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/SearchProviderImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/SearchProviderImpl.java @@ -28,6 +28,9 @@ import me.shedaniel.rei.api.client.search.SearchProvider; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.impl.client.search.argument.Argument; import me.shedaniel.rei.impl.client.search.argument.CompoundArgument; +import me.shedaniel.rei.impl.client.util.CrashReportUtils; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; import java.util.List; import java.util.Objects; @@ -54,7 +57,18 @@ public class SearchProviderImpl implements SearchProvider { @Override public boolean test(EntryStack stack) { - return Argument.matches(stack, arguments); + try { + return Argument.matches(stack, arguments); + } catch (Throwable throwable) { + CrashReport report = CrashReportUtils.essential(throwable, "Testing entry with search filter"); + CrashReportCategory category = report.addCategory("Search entry details"); + try { + stack.fillCrashReport(report, category); + } catch (Throwable throwable1) { + category.setDetailError("Filling Report", throwable1); + } + throw CrashReportUtils.throwReport(report); + } } @Override -- cgit