Browse Source

catch ratelimit exception but not tested

master
patrick 6 years ago
parent
commit
47e5928738
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      Xero.php

+ 9
- 2
Xero.php View File

@@ -2,6 +2,8 @@
namespace Biukop;

use \XeroPHP\Application\PrivateApplication;
use \XeroPHP\Remote\Exception\RateLimitExceededException;

class Xero {
private $xero;
private $clientgroup="48646f3d-cf5e-4fea-8c8b-5812bd540e1b";
@@ -70,8 +72,13 @@ class Xero {
//sync users to wordpress system
//does not work for too many users or employees
public function sync_users(){
$this->sync_clients();
$this->sync_employees();
try{
$this->sync_clients();
$this->sync_employees();
}catch(RateLimitExceededException $e){
$msg= "Xero API rate limit exceeded, please try again later, existing sync within 600 seconds will by passed automatically\n";
$this->logConsole($msg);
}
}
private function sync_clients(){
$contacts = $this->getClients($this->clientgroup);

Loading…
Cancel
Save