Error handling

Options

Hi there,

I'm having trouble wrapping my head around error handling. I'm calling an external API and sometimes it might through some error. I want to be notified about it immediatle via email.

I made the following logic:

The problem is, the If/else conditional won't execute since the function stack stops after the API request returns an error, so Xano won't send an email about it with Sendgrid (which is the Else part of the conditional).

What am I missing? How shoud I structure this logic?

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi, Tom. Can you describe the errors you're trying to build handling for? Typically, an external API request won't halt execution of the function; the error response will just be stored in the target variable.

  • Tom Wolf
    Tom Wolf Member
    Options

    Hi, Chris. Ok, my bad, but your message kind of clarified it for me. I was checkint for null whereas I was supposed to check for a response status different than 200 :)

    Thanks!