diff --git a/index.js b/index.js index 39be43057c00c2665b0bcdbde7f4d93b71244b17..6a6abec337f03d27a5799f5d932f52ae501de7c1 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,7 @@ Sentry.init({ // The start function is run by the BaseKonnector instance only when it got all the account // information (fields). When you run this connector yourself in 'standalone' mode or 'dev' mode, // the account information come from ./konnector-dev-config.json file -async function start(fields, cozyParameters, cozyUrl) { +async function start(fields, cozyParameters) { const transaction = Sentry.startTransaction({ op: 'konnector', name: 'EGL Konnector', @@ -94,8 +94,7 @@ async function start(fields, cozyParameters, cozyUrl) { fields.login, fields.password, baseUrl, - apiAuthKey, - cozyUrl + apiAuthKey ) log('info', 'Successfully logged in') @@ -207,7 +206,7 @@ async function buildAggregatedData(data, doctype) { return aggregatedData } -async function authenticate(login, password, baseUrl, apiAuthKey, cozyUrl) { +async function authenticate(login, password, baseUrl, apiAuthKey) { const authRequest = { method: 'post', url: baseUrl + '/connect.aspx', @@ -238,7 +237,6 @@ async function authenticate(login, password, baseUrl, apiAuthKey, cozyUrl) { }, extra: { compte: login, - url: cozyUrl.cozyURL, }, }) throw new Error(errors.LOGIN_FAILED) @@ -246,8 +244,6 @@ async function authenticate(login, password, baseUrl, apiAuthKey, cozyUrl) { } async function getData(response, baseUrl, apiAuthKey) { - log('debug', 'Start date : ' + startDate) - log('debug', 'End date : ' + endDate) const dataRequest = { method: 'post', url: baseUrl + '/getAllAgregatsByAbonnement.aspx', @@ -292,10 +288,15 @@ async function getData(response, baseUrl, apiAuthKey) { throw errors.UNKNOWN_ERROR } } catch (error) { - Sentry.captureException(`GetData failed: ${error.message}`, { + log('debug', error.message) + Sentry.captureException(error, { tags: { section: 'getData', }, + extra: { + start: startDate, + end: endDate, + }, }) if (axios.isAxiosError(error)) { throw new Error(errors.VENDOR_DOWN)