From fb9fd572102466cd4a1c5829e6af3197c107ee2e Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 23 Feb 2024 03:16:51 -0500 Subject: [PATCH] Improve json parsing error handling. --- source/funkin/data/BaseRegistry.hx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/funkin/data/BaseRegistry.hx b/source/funkin/data/BaseRegistry.hx index 0ccbe2f18..62a7eb0f7 100644 --- a/source/funkin/data/BaseRegistry.hx +++ b/source/funkin/data/BaseRegistry.hx @@ -61,7 +61,16 @@ abstract class BaseRegistry & Constructible = null; + try + { + entry = createScriptedEntry(entryCls); + } + catch (e:Dynamic) + { + log('Failed to create scripted entry (${entryCls})'); + continue; + } if (entry != null) { @@ -196,6 +205,11 @@ abstract class BaseRegistry & Constructible { + if (version == null) + { + throw '[${registryId}] Entry ${id} could not be JSON-parsed or does not have a parseable version.'; + } + // If a version rule is not specified, do not check against it. if (versionRule == null || VersionUtil.validateVersion(version, versionRule)) {