Comments (4)
I just updated the blog post. Note that the extension file has changed to update must_fail
.
The discussion in External Contract Example about must_fail
has been updated to show how to catch the error message of a failure.
Let me know if this works for you, and if it does, would you mind closing this issue?
from techelson.
Glad it works for you, let me know if you have more questions/problems!
from techelson.
Hey!
By your message you seem to be using Techelson with Liquidity. If you look at the external contract example Section in my blog post, you will see that I use Techel.must_fail
which almost does what you want.
At liquidity level, you currently cannot use this extension to catch error messages. But if you look at how the extensions are defined,
external must_fail :
[%stack: operation] -> [%stack: operation]
= "{ NONE string ; MUST_FAIL string }"
The weird NONE string
that's pushed on the stack is exactly what you want: it is the error message of the failure. I'm going to update the post to allow users to specify the error message and pass it to must_fail
.
In the mean time, you can rewrite the definition of must_fail
to
external must_fail :
[%stack: string] -> [%stack: operation] -> [%stack: operation]
= "{ DIP { SOME } ; MUST_FAIL string }"
Then you can use it as must_fail <error_string> <operation>
. This will work iff <operation>
fails with message <error_string>
.
I'll notify you once the Liquidity blog post is updated.
Thank you!
from techelson.
Fantastic 🎉 Works perfectly! Thanks a bunch 🙌
from techelson.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from techelson.