-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QA] Monitorer la plateforme et tracker les erreurs JS #2230
Changes from all commits
c82aee7
129ced5
8048c89
ed9e2c9
78395c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const SENTRY_DSN_FRONT = process.env.SENTRY_DSN_FRONT | ||
const SENTRY_ENVIRONMENT = process.env.SENTRY_ENVIRONMENT | ||
const SENTRY_TRACES_SAMPLE_RATE = parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE) | ||
const AXIOS_TIMEOUT = parseInt(process.env.AXIOS_TIMEOUT) | ||
|
||
export { | ||
SENTRY_DSN_FRONT, | ||
SENTRY_ENVIRONMENT, | ||
SENTRY_TRACES_SAMPLE_RATE, | ||
AXIOS_TIMEOUT | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Pour en savoir plus |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import axios from 'axios' | ||
import formStore from './store' | ||
import * as Sentry from '@sentry/browser' | ||
import { AXIOS_TIMEOUT } from '../../../controllers/environment' | ||
|
||
export const requests = { | ||
// TODO : voir avec Emilien pour ne plus gérer via des callbacks mais faire de l'async pour rendre le code plus lisible | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Réflexion partagé cette été mais pas d'enjeu je supprime (une histoire d'habitude) |
||
doRequestGet (ajaxUrl: string, functionReturn: Function) { | ||
axios | ||
.get(ajaxUrl, { timeout: 15000 }) | ||
.get(ajaxUrl, { timeout: AXIOS_TIMEOUT }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. J'ai pas appliqué la constante à tous les composants car l'enjeu est uniquement sur le formulaire |
||
.then(response => { | ||
const responseData = response.data | ||
functionReturn(responseData) | ||
}) | ||
.catch(error => { | ||
console.log(error) | ||
console.error(error) | ||
Sentry.captureException(new Error(error)) | ||
functionReturn('error') | ||
}) | ||
}, | ||
doRequestPost (ajaxUrl: string, data: any, functionReturn: Function, config: any) { | ||
if (config !== undefined) { | ||
config.timeout = 15000 | ||
config.timeout = AXIOS_TIMEOUT | ||
} else { | ||
config = { timeout: 15000 } | ||
config = { timeout: AXIOS_TIMEOUT } | ||
} | ||
axios | ||
.post(ajaxUrl, data, config) | ||
|
@@ -28,19 +30,21 @@ export const requests = { | |
functionReturn(responseData) | ||
}) | ||
.catch(error => { | ||
console.log(error) | ||
console.error(error) | ||
Sentry.captureException(new Error(error)) | ||
functionReturn(error) | ||
}) | ||
}, | ||
doRequestPut (ajaxUrl: string, data: any, functionReturn: Function) { | ||
axios | ||
.put(ajaxUrl, data, { timeout: 15000 }) | ||
.put(ajaxUrl, data, { timeout: AXIOS_TIMEOUT }) | ||
.then(response => { | ||
const responseData = response.data | ||
functionReturn(responseData) | ||
}) | ||
.catch(error => { | ||
console.log(error) | ||
console.error(error) | ||
Sentry.captureException(new Error(error)) | ||
functionReturn('error') | ||
}) | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finalement besoin de ces valeurs sur la phase de build js et y'a pas d'enjeu à exposer ces valeurs, faudra par contre filtrer les événements provenant de localhost sur le dashboard