Skip to content

Commit

Permalink
Warn about fixed length Photon arrays instead of throwing (#274)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwbonner authored Nov 19, 2024
1 parent e0ba464 commit 9c642ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/shared/log/PhotonStructDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ 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
name = nameStr;
}

if (isOptional && isArray) {
throw Error("Can't be optional AND array?");
console.warn("Can't be optional AND array?");
return false;
}

// Create schema
Expand Down

0 comments on commit 9c642ac

Please sign in to comment.