From 553631c4562defe0ef2a72aec742d9b8c014f6b6 Mon Sep 17 00:00:00 2001 From: "guilhem.carron" <gcarron@grandlyon.com> Date: Mon, 5 Jul 2021 15:10:47 +0200 Subject: [PATCH] Add doc for the half hour issue fix --- docs/konnectors/enedis.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/konnectors/enedis.md b/docs/konnectors/enedis.md index 466f711..1eb843b 100644 --- a/docs/konnectors/enedis.md +++ b/docs/konnectors/enedis.md @@ -20,7 +20,7 @@ id token is only given when requesting the token endpoint in \_authorization_cod This token holds several meta datas, including the usage_point_id (id of user's meter) that will be needed further to fetch user's datas. - Konnector starts, if no usage_point_id are found in database or fields then proceed as a first launch. Store the usage_point_id in oauth_callback_result in db (see [addData](https://docs.cozy.io/en/cozy-konnector-libs/api/#adddata_1)). -- Konnector finds usage_point_id when starting but token is expired. Proceed to refresh token and restart konnector with usage_point_id in fields params (see _Troubleshooting when asking for refresh token_ section at the end of the page). +- Konnector finds usage*point_id when starting but token is expired. Proceed to refresh token and restart konnector with usage_point_id in fields params (see \_Troubleshooting when asking for refresh token* section at the end of the page). ## Enedis API @@ -89,3 +89,19 @@ Line 85: `` await cozyClient.fetchJSON( 'POST', `/accounts/enedisgrandlyon/${acc Line 98: ```return start(fields, cozyParameters, false)``` In fact the usage_point_id still remains in the account collection, but on restart, the konnector loses `this._account` context leading to an error when searching for usage_point_id in account. + +## Half-hour data issue + +When requesting the load curve api while the half-hour data is not activated, we may have an error response 404 with a message "no data found", which makes the whole data fetching process crash. So instead of making it crash we just log this particular error and avoid the konnector to crash. +So we added a condition in line 227, in the _checkConsentForLoadCurve_ function : + +``` + if ( + (err.statusCode === 404 || err.code === 404) && + err.message.search('no_data_found') > 0 + ) { + log('info', 'Handling half-hour error on connection') + return false + } + +``` -- GitLab