From 9cf23a81850221688007eb20ca0a04cd6e49b356 Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Fri, 2 Dec 2022 14:43:32 +0100 Subject: [PATCH] publish: wip basic transactions generated from commit 5dfb35255ca390289f6f03df47797b3a7e8d5909 --- index.js | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 57f8071..544b236 100644 --- a/index.js +++ b/index.js @@ -99,15 +99,15 @@ async function start(fields, cozyParameters) { Sentry.captureEvent({ message: 'konnector launch 3' }) - setTimeout(() => { - try { - test() - } catch (e) { - Sentry.captureException(e) - } finally { - // transaction.finish() - } - }, 99) + // setTimeout(() => { + // try { + // test() + // } catch (e) { + // Sentry.captureException(e) + // } finally { + // // transaction.finish() + // } + // }, 99) const pointId = parseInt(fields.pointId) let baseUrl = fields.wso2BaseUrl @@ -166,7 +166,7 @@ async function start(fields, cozyParameters) { user.hasBeenThroughtSafetyOnBoarding ) - // handle user contract start date in order to preperly request data + // handle user contract start date in order to properly request data const userContractstartDate = await getContractStartDate( baseUrl, apiAuthKey, @@ -544,7 +544,7 @@ function processData(doctype = 'com.grandlyon.enedis.day') { `No half-hour activated. Issue: ${result.Envelope.Body.Fault.faultstring}` ) } else { - log('warn', `Unkown error ${e}`) + log('warn', `Unknown error ${e}`) } } } @@ -567,7 +567,7 @@ async function storeData(data, doctype, filterKeys) { } /** - * Agregate data from daily data to monthly and yearly data + * Aggregate data from daily data to monthly and yearly data */ async function agregateMonthAndYearData(data) { // Sum year and month values into object with year or year-month as keys @@ -611,10 +611,10 @@ function isFirstStart(account) { log('info', 'Konnector first start') return true } -function test() { - Sentry.captureException('capture exception inside test') - throw new Error('Function test not implemented.') -} +// function test() { +// Sentry.captureException('capture exception inside test') +// throw new Error('Function test not implemented.') +// } /***/ }), @@ -242104,6 +242104,7 @@ const { } = __webpack_require__(1561) const xml2js = __webpack_require__(1519) const { consulterDonneesTechniquesContractuelles } = __webpack_require__(1562) +const Sentry = __webpack_require__(1610) /** * Get user contract start date @@ -242138,12 +242139,19 @@ async function findUserAddress(url, apiAuthKey, userLogin, pointId) { try { return parseUserAddress(result) } catch (error) { - log('error', 'Error while processing user address: ' + error) + const errorMessage = 'Error while processing user address: ' + error + log('error', errorMessage) log( 'error', `Enedis issue ${result.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${result.Envelope.Body.Fault.faultstring}` ) + Sentry.captureException(errorMessage) + Sentry.captureEvent({ message: errorMessage }) + pwet() throw errors.LOGIN_FAILED + } finally { + log('info', 'FINALLY') + Sentry.captureException('Error while processing user address') } } -- GitLab