Skip to content

Commit

Permalink
Merge pull request #105 from Phpvarious/patch-9
Browse files Browse the repository at this point in the history
added a specific log for "Quotas exceeded"
  • Loading branch information
Sekiro-kost authored Sep 24, 2024
2 parents c91c0ac + d4b3439 commit ea58548
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/class/mobile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -918,10 +918,15 @@ public static function notification($arn, $os, $titre, $message, $type, $idNotif
sleep(rand(1,10));
$result = json_decode($request_http->exec(30,3), true);
}
log::add('mobile', 'debug', '|└────────────────────');
if (!isset($result['state']) || $result['state'] != 'ok') {
throw new Exception(__('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
if (isset($result['error']) && strpos($result['error'], 'Quotas exceeded') !== false) {
log::add('mobile', 'error', __("Les quotas pour fcm sont dépassés. Le maximum autorisé est de 5 requêtes par minute.", __FILE__));
log::add('mobile', 'debug', __('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
} else {
throw new Exception(__('Echec de l\'envoi de la notification :', __FILE__) . json_encode($result));
}
}
log::add('mobile', 'debug', '|└────────────────────');
}

public function SaveGeoloc($geoloc)
Expand Down

0 comments on commit ea58548

Please sign in to comment.