cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
761
Views
0
Helpful
1
Replies

Handling API responses in Perl

d_a_parker
Level 1
Level 1

Hello,

I am working on a few Perl scripts using the Duo::API module from GitHub. I am mostly using json_api_call() and everything seems to work fine, except that if there is an error, the script just prints the API response message and dies. This seems to be from the call to croak($msg) in the parse_json_response() function.

My question is, what is the best way to check the API response and catch an error cleanly, instead of having it just bail out? I would ideally like to log the error and keep going.

Thanks!

1 Reply 1

Amy2
Level 5
Level 5

Hi @d_a_parker, and welcome to the Duo Community! This doesn’t really help with the “log the error and keep going” part of your question, but we have an article that explains the Duo API responses and error messages that seems like it would be useful. Give it a look, and let me know if you have any additional questions. Hopefully, others who are more experienced in using our API can chime in to help!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links