Need to return response with failure information for processing response on drupal side.

Case for example:
We send notification to several recipients, some tokens was outdated (because app was removed) - need to determine outdated and remove token from drupal.

Comments

nabiyllin created an issue. See original summary.

r.nabiullin’s picture

Status: Active » Needs review
StatusFileSize
new3.39 KB
new27.69 KB

Also I changed log process, I divided into 2 situations -> when notification has one recipient and multiple, it will more logically, because we not will see error in situation as on screenshot.

andypost’s picture

+++ b/src/Service/FirebaseServiceBase.php
@@ -102,31 +104,44 @@ class FirebaseServiceBase implements FirebaseServiceInterface {
+    catch (\Exception $e) {
+      // Error connecting to Firebase API.
+      $this->messenger()->addError($e->getMessage());
+      $this->logger->error($e->getMessage());

it is a bad idea to use messenger in service - better to move it to calling code

andypost’s picture

Also that's API break because all consumers of the service expects exception which will not be thrown now

r.nabiullin’s picture

Fixed

leopaccanaro’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.