I keep getting a max number of requests error in my function

I keep getting a max number of requests error in my function

There was a change in how report automation is made and it caused us having to create a custom function in zoho expense. I'm trying to grab all expenses of the month from each user and create a report. However, I'm getting too many API Calls error. How am i able to fix that? try used a try-catch but I was still getting the same error. This is my current code, there are over 100 users.

  1. userList = List();
  2. currentMonth = zoho.currentdate;
  3. firstDay = currentMonth.eomonth(0);
  4. lastDay = currentMonth.eomonth(-1).addDay(1);
  5. headerUser = Map();
  6. headerUser.put("X-com-zoho-expense-organizationid","643169496");
  7. usersresponse = invokeurl
  8. [
  9. url :"https://www.zohoapis.com/expense/v1/users"
  10. type :GET
  11. headers:headerUser
  12. connection:"adminexpense"
  13. ];
  14. users = usersresponse.get("users");
  15. for each  person in users
  16. {
  17. userID = person.get("user_id");
  18. userList.add(userID);
  19. }
  20. for each  ID in userList
  21. {
  22. params = Map();
  23. params.put("user_id",ID);
  24. params.put("date_start",firstDay);
  25. params.put("date_end",lastDay);
  26. headers_data = Map();
  27. headers_data.put("X-com-zoho-expense-organizationid","643169496");
  28. response = invokeurl
  29. [
  30. url :"https://www.zohoapis.com/expense/v1/reports/expensedetails"
  31. type :GET
  32. parameters:params
  33. headers:headers_data
  34. connection:"adminexpense"
  35. ];
  36. if(response.get("message") == "Please check the date range")
  37. {
  38. continue;
  39. }
  40. info response;
  41. }