How to capture and return plugin API http errors

Hi, I can’t find any doc that explains how to capture errors that might be returned by API calls within plugins. The happy path in my case returns a JSON body with expected data but no error, while the error case returns code and message fields. I can’t seem to capture both. If I could, then the workflow could check the code for non-empty error result.

If we can’t capture API errors then the user sees an undesirable error dialog.

The only way I see to really use API is to implement within a JavaScript element or action that leverages a request package. Is this how one should properly issue API requests that can handle errors?

Ted

Yeap … once you have an action that does not complete you can generate an error log thing to the dB. And build an internal UI to display them.

Did you ever solved this?

I’m having the same issue.

The API call in my plugin normally returns a http 200 code, and the action runs fine in workflows. But when the API returns a 400 code it breaks, without anyway for me to handle the error.

I did not. I was forced to pull network requests into my code to handle errors.