How to add an "If Error" to API
Options
![Abdullah Abdulkareem](https://us.v-cdn.net/6037124/user_avatars/3263911.jpg)
Abdullah Abdulkareem
Member ✭
Is there a way to add a line in the API that returns null if a certain function line returns an error?
Comments
-
Not sure if there's anything cleaner, but you could do logic on the receiving end to respond to the different response codes.
-
Thank you ! The challenge is the entire API fails and returns an error, whereas I want to "isolate" the variable that's causing the error and return it as null if that's helpful
-
ah okay. I think I'm following. Is the error getting thrown because the variable isn't used in all the conditional paths? If so, what I do is assign the variable at the top of the function stack - and then, when I would normally use "create variable" I use "update variable" instead.
If that's not the issue, what's causing the error to get thrown?
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