How to ignore error " Unable to locate var: XYZ"
![Anna Sho](https://us.v-cdn.net/6037124/uploads/userpics/9J2BDR93V3FA/nAMOURF2V6E1B.jpeg)
I have some external function in function stack, and it can return object with "result.data" or "result.error".
How can I add condition to ignore if func. returns "result.error" object?
I tried to work around "result.data" is empty or undefined etc.. and looks like each time system is trying to read missing var.
Answers
-
You can use the "get" and "has" filters to check for whether a variable contains a certain member. Like from your api call, you might put api_1.response|has "data" into the comndition for an if/then. Then you can move inside the then using dot notation with the confidence data is present, and move in the else like it is not.
This check is a best practice, since its not a guarantee that a third party will give you a happy response. -
@Ray Deck amazing, that worked! Huge thanks to you.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback