Skip to content
Snippets Groups Projects
Commit 4d2806a9 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

fix: handle passerelle down

parent 29e3c848
No related branches found
No related tags found
1 merge request!46fix: handle passerelle down
...@@ -32,50 +32,60 @@ async function findUserPdl( ...@@ -32,50 +32,60 @@ async function findUserPdl(
apikey: apiAuthKey, apikey: apiAuthKey,
} }
const { response } = await soapRequest({ try {
url: url, const { response } = await soapRequest({
headers: sgeHeaders, url: url,
xml: rechercherPoint( headers: sgeHeaders,
appLogin, xml: rechercherPoint(
lastname, appLogin,
postalCode, lastname,
inseeCode, postalCode,
address, inseeCode,
escalierEtEtageEtAppartement address,
), escalierEtEtageEtAppartement
}).catch(err => { ),
const errorMessage = 'Error while finding user pdl : ' + err.message }).catch(err => {
log('error', errorMessage) const errorMessage = 'Error while finding user pdl : ' + err.message
Sentry.captureException(errorMessage, { log('error', errorMessage)
Sentry.captureException(errorMessage, {
tags: {
section: 'findUserPdl',
},
extra: {
address: address,
postalCode: postalCode,
escalierEtEtageEtAppartement: escalierEtEtageEtAppartement,
},
})
throw new Error(errors.VENDOR_DOWN)
})
const parsedReply = await xml2js.parseStringPromise(response.body, {
tagNameProcessors: [parseTags],
valueProcessors: [parseValue],
explicitArray: false,
})
try {
return parseUserPdl(parsedReply)
} catch (error) {
log('warn', 'Error while parsing user PDL: ' + error)
if (parsedReply.Envelope.Body.Fault) {
log(
'warn',
`Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}`
)
}
return null
}
} catch (error) {
log('error', 'Error while findingUserPdl', error)
Sentry.captureException(error, {
tags: { tags: {
section: 'findUserPdl', section: 'findUserPdl',
}, },
extra: {
address: address,
postalCode: postalCode,
escalierEtEtageEtAppartement: escalierEtEtageEtAppartement,
},
}) })
throw new Error(errors.VENDOR_DOWN) throw new Error(errors.VENDOR_DOWN)
})
const parsedReply = await xml2js.parseStringPromise(response.body, {
tagNameProcessors: [parseTags],
valueProcessors: [parseValue],
explicitArray: false,
})
try {
return parseUserPdl(parsedReply)
} catch (error) {
log('warn', 'Error while parsing user PDL: ' + error)
if (parsedReply.Envelope.Body.Fault) {
log(
'warn',
`Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}`
)
}
return null
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment