1

Is it possible to include the value of variables in error messages?

For example I would like to do something like this Javascript / Archetype hybrid:

do_require(feeOne + feeTwo = feeTotal, `Fees do not correctly add up! Fee one: ${feeOne} + fee two: ${feeTwo} does not equal the fee total of: ${feeTotal}`);

Through some trial and error I found that it IS possible to do this: do_require(feeOne + feeTwo = feeTotal, feeOne); This prints out something like:

     Error: the object {
  "value": "5000000"
} was thrown, throw an Error :)

This has been useful for debugging, but even this would require me to run the test three times if I want to look at each of the 3 variables in the line above, so I would like to know if there is a better way.

I've tried search for template literal in the archetype docs and searching tezos stack exchange/ google but I may well be using the wrong search term here as I only know what it is called in JS.

Help appreciated, thanks.

1 Answer 1

1

sorry for late reply. Short answer is no, not as you describe it, but it is possible to embed any value in an fail value thanks to tuple.

fail(("A MESSAGE", feeOne, feeTwo, feeTotal));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.