Skip to content

Commit edc29f2

Browse files
committed
fix(orchestration): add more user friendly error when a commitment can't be found with the correct state variable id
1 parent 12e48c0 commit edc29f2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class BoilerplateGenerator {
4343
${stateVarIds.join('\n')}
4444
\nlet ${stateName}_commitmentExists = true;
4545
\nconst ${stateName}_commitment = await getCurrentWholeCommitment(${stateName}_stateVarId);
46+
\nif (!${stateName}_commitment) {
47+
\n\tthrow new Error('Unable to find a non-nullified ${stateName} commitment with state id ' + ${stateName}_stateVarId + '.');
48+
\n}
4649
\nconst ${stateName}_preimage = ${stateName}_commitment.preimage;
4750
\nconst ${stateName} = generalise(${stateName}_preimage.value);`];
4851
default:

0 commit comments

Comments
 (0)