From dd2e5974b63576496b16edbac390b74f19c56bb0 Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Wed, 21 Sep 2022 09:57:08 +0200
Subject: [PATCH] publish: fix login failed

generated from commit 08720f6cfef57b86594e40944e947e7a5a3c6596
---
 index.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index b4c74eb..2ae14aa 100644
--- a/index.js
+++ b/index.js
@@ -228371,10 +228371,12 @@ async function findUserPdl(
     return parseUserPdl(parsedReply)
   } catch (error) {
     log('error', 'Error while parsing user PDL: ' + error)
-    log(
-      'error',
-      `Enedis issue ${parsedReply.Envelope?.Body?.Fault?.detail?.erreur?.resultat?.$?.code}: ${parsedReply.Envelope?.Body?.Fault?.faultstring}`
-    )
+    if (parsedReply.Envelope.Body.Fault) {
+      log(
+        'error',
+        `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}`
+      )
+    }
     throw errors.LOGIN_FAILED
   }
 }
-- 
GitLab