From 9c642ac40b220c84b86af602dba2851bd7330cef Mon Sep 17 00:00:00 2001 From: Jonah Bonner <47046556+jwbonner@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:36:37 -0500 Subject: [PATCH] Warn about fixed length Photon arrays instead of throwing (#274) Fixed length arrays are supported by non-Photon structs, which still need to be compiled by PhotonStructDecoder. This isn't an actual issue unless a Photon struct tries to use a struct with an unsupported array. Returning false just indicates that the schema cannot be compiled or used in parent schemas. --- src/shared/log/PhotonStructDecoder.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/log/PhotonStructDecoder.ts b/src/shared/log/PhotonStructDecoder.ts index 7dcef7c3..89cc1e97 100644 --- a/src/shared/log/PhotonStructDecoder.ts +++ b/src/shared/log/PhotonStructDecoder.ts @@ -67,7 +67,8 @@ export default class PhotonStructDecoder { if (arrayLengthStr === "?") { isArray = true; // VLA } else { - throw new Error("Fixed length arrays are unimplemented"); + console.warn("Fixed length arrays are unimplemented"); + return false; } } else { // Normal value @@ -75,7 +76,8 @@ export default class PhotonStructDecoder { } if (isOptional && isArray) { - throw Error("Can't be optional AND array?"); + console.warn("Can't be optional AND array?"); + return false; } // Create schema