Skip to content

Commit

Permalink
VOM: improve facets-dont-match-original error message
Browse files Browse the repository at this point in the history
  • Loading branch information
warner committed Apr 5, 2023
1 parent 050d844 commit de1942c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/swingset-liveslots/src/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,17 @@ function checkAndUpdateFacetiousness(
if (!facetNames && desc.facets) {
Fail`defineDurableKind called for faceted KindHandle ${tag}`;
}
const m = `durable kind "${tag}" facets don't match original definition`;
if (facetNames) {
let ok = true;
for (const [idx, facet] of facetNames.entries()) {
assert(facet === desc.facets[idx], m);
if (facet !== desc.facets[idx]) {
ok = false;
}
}
if (!ok) {
const orig = desc.facets.join(',');
const newer = facetNames.join(',');
Fail`durable kind "${tag}" facets (${newer}) don't match original definition (${orig})`;
}
}
}
Expand Down

0 comments on commit de1942c

Please sign in to comment.