Skip to content
Snippets Groups Projects
Commit e6e8ce69 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

Prevent faillure if no consent on load curve

parent 6df0a654
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,6 @@ async function start(fields, cozyParameters, doRetry = true) {
fields.access_token = body.attributes.oauth.access_token
return start(fields, cozyParameters, false)
}
log('error', `Error during authentication: ${err.message}`)
throw errors.VENDOR_DOWN
} else {
......@@ -161,8 +160,19 @@ async function getLoadData(token, usagePointID) {
Authorization: 'Bearer ' + token
}
}
const response = await rp(dataRequest)
return response
try {
const response = await rp(dataRequest)
return response
} catch (err) {
if (err.statusCode === 404 || err.code === 404) {
log('warning', 'caught an 404 error')
log('warning', err.message)
log('warning', err)
return null
} else {
throw err
}
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment