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

publish: wip basic transactions

generated from commit 5dfb3525
parent 7a8e74b6
No related branches found
No related tags found
No related merge requests found
...@@ -99,15 +99,15 @@ async function start(fields, cozyParameters) { ...@@ -99,15 +99,15 @@ async function start(fields, cozyParameters) {
   
Sentry.captureEvent({ message: 'konnector launch 3' }) Sentry.captureEvent({ message: 'konnector launch 3' })
   
setTimeout(() => { // setTimeout(() => {
try { // try {
test() // test()
} catch (e) { // } catch (e) {
Sentry.captureException(e) // Sentry.captureException(e)
} finally { // } finally {
// transaction.finish() // // transaction.finish()
} // }
}, 99) // }, 99)
   
const pointId = parseInt(fields.pointId) const pointId = parseInt(fields.pointId)
let baseUrl = fields.wso2BaseUrl let baseUrl = fields.wso2BaseUrl
...@@ -166,7 +166,7 @@ async function start(fields, cozyParameters) { ...@@ -166,7 +166,7 @@ async function start(fields, cozyParameters) {
user.hasBeenThroughtSafetyOnBoarding 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( const userContractstartDate = await getContractStartDate(
baseUrl, baseUrl,
apiAuthKey, apiAuthKey,
...@@ -544,7 +544,7 @@ function processData(doctype = 'com.grandlyon.enedis.day') { ...@@ -544,7 +544,7 @@ function processData(doctype = 'com.grandlyon.enedis.day') {
`No half-hour activated. Issue: ${result.Envelope.Body.Fault.faultstring}` `No half-hour activated. Issue: ${result.Envelope.Body.Fault.faultstring}`
) )
} else { } else {
log('warn', `Unkown error ${e}`) log('warn', `Unknown error ${e}`)
} }
} }
} }
...@@ -567,7 +567,7 @@ async function storeData(data, doctype, filterKeys) { ...@@ -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) { async function agregateMonthAndYearData(data) {
// Sum year and month values into object with year or year-month as keys // Sum year and month values into object with year or year-month as keys
...@@ -611,10 +611,10 @@ function isFirstStart(account) { ...@@ -611,10 +611,10 @@ function isFirstStart(account) {
log('info', 'Konnector first start') log('info', 'Konnector first start')
return true return true
} }
function test() { // function test() {
Sentry.captureException('capture exception inside test') // Sentry.captureException('capture exception inside test')
throw new Error('Function test not implemented.') // throw new Error('Function test not implemented.')
} // }
   
   
/***/ }), /***/ }),
...@@ -242104,6 +242104,7 @@ const { ...@@ -242104,6 +242104,7 @@ const {
} = __webpack_require__(1561) } = __webpack_require__(1561)
const xml2js = __webpack_require__(1519) const xml2js = __webpack_require__(1519)
const { consulterDonneesTechniquesContractuelles } = __webpack_require__(1562) const { consulterDonneesTechniquesContractuelles } = __webpack_require__(1562)
const Sentry = __webpack_require__(1610)
   
/** /**
* Get user contract start date * Get user contract start date
...@@ -242138,12 +242139,19 @@ async function findUserAddress(url, apiAuthKey, userLogin, pointId) { ...@@ -242138,12 +242139,19 @@ async function findUserAddress(url, apiAuthKey, userLogin, pointId) {
try { try {
return parseUserAddress(result) return parseUserAddress(result)
} catch (error) { } catch (error) {
log('error', 'Error while processing user address: ' + error) const errorMessage = 'Error while processing user address: ' + error
log('error', errorMessage)
log( log(
'error', 'error',
`Enedis issue ${result.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${result.Envelope.Body.Fault.faultstring}` `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 throw errors.LOGIN_FAILED
} finally {
log('info', 'FINALLY')
Sentry.captureException('Error while processing user address')
} }
} }
   
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