File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ class QuickBase {
4141 'errcode ' => 0 ,
4242 'errtext ' => 'No error ' ,
4343 'errdetail ' => ''
44- )
44+ ),
45+
46+ 'maxErrorRetryAttempts ' => 3
4547 );
4648
4749 public function __construct ($ options = array ()){
@@ -102,6 +104,8 @@ class QuickBaseQuery {
102104 public $ options = array ();
103105 public $ response = array ();
104106
107+ private $ nErrors = 0 ;
108+
105109 protected $ payload = '' ;
106110
107111 public function __construct (&$ parent , $ action = '' , $ options = array ()){
@@ -174,7 +178,9 @@ final public function constructPayload(){
174178
175179 final public function checkForAndHandleError (){
176180 if ($ this ->response ['errcode ' ] != $ this ->settings ['status ' ]['errcode ' ]){
177- if ($ this ->response ['errcode ' ] == 4 && isset ($ this ->parent ->settings ['username ' ]) && isset ($ this ->parent ->settings ['password ' ])){
181+ ++$ this ->nErrors ;
182+
183+ if ($ this ->nErrors <= $ this ->parent ->settings ['maxErrorRetryAttempts ' ] && $ this ->response ['errcode ' ] == 4 && isset ($ this ->parent ->settings ['username ' ]) && isset ($ this ->parent ->settings ['password ' ])){
178184 try {
179185 $ newTicket = $ this ->parent ->api ('API_Authenticate ' , array (
180186 'username ' => $ this ->parent ->settings ['username ' ],
@@ -258,6 +264,12 @@ final public function transmit(){
258264 curl_close ($ ch );
259265
260266 if ($ response === false ){
267+ ++$ this ->nErrors ;
268+
269+ if ($ this ->nErrors <= $ this ->settings ['maxErrorRetryAttempts ' ]){
270+ return $ this ->transmit ();
271+ }
272+
261273 throw new QuickBaseError ($ errno , $ error );
262274 }
263275
You can’t perform that action at this time.
0 commit comments