How to ignore error " Unable to locate var: XYZ"

Options

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

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    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.

  • Anna Sho
    Anna Sho Member
    Options

    @Ray Deck amazing, that worked! Huge thanks to you.