@defra-fish/connectors-lib 1.63.0-debug-airbrake-failure-7 → 1.63.0-debug-airbrake-failure-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/airbrake.js +5 -6
package/package.json
CHANGED
package/src/airbrake.js
CHANGED
|
@@ -16,18 +16,16 @@ export const reset = () => {
|
|
|
16
16
|
*/
|
|
17
17
|
export const initialise = () => {
|
|
18
18
|
if (!airbrake && process.env.AIRBRAKE_PROJECT_KEY && process.env.AIRBRAKE_HOST) {
|
|
19
|
-
console.log('creating new Notifier', process.env.AIRBRAKE_PROJECT_KEY, process.env.AIRBRAKE_HOST, process.env.NODE_ENV)
|
|
20
19
|
airbrake = new Notifier({
|
|
21
20
|
projectId: 1,
|
|
22
21
|
projectKey: process.env.AIRBRAKE_PROJECT_KEY,
|
|
23
22
|
host: process.env.AIRBRAKE_HOST,
|
|
24
23
|
environment: process.env.NODE_ENV,
|
|
25
24
|
performanceStats: false,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
errorNotifications: true
|
|
25
|
+
errorNotifications: true,
|
|
26
|
+
remoteConfig: false
|
|
30
27
|
})
|
|
28
|
+
console.log(`created new Notifier with error notifications set ${airbrake._opt.errorNotifications ? 'on' : 'off'}`)
|
|
31
29
|
|
|
32
30
|
// Proxy the console.warn and console.error methods, notifying airbrake/errbit asynchronously
|
|
33
31
|
const nativeConsoleMethods = {}
|
|
@@ -37,7 +35,8 @@ export const initialise = () => {
|
|
|
37
35
|
console[method] = async (...args) => {
|
|
38
36
|
const error = args.find(arg => arg instanceof Error) ?? new Error(formatWithOptions(INSPECT_OPTS, ...args))
|
|
39
37
|
const request = args.find(arg => Object.prototype.hasOwnProperty.call(arg, 'headers'))
|
|
40
|
-
console.log(`notifying airbrake for console.${method}`, INSPECT_OPTS)
|
|
38
|
+
console.log(`notifying airbrake for console.${method}, error notifications is ${airbrake._opt.errorNotifications ? 'on' : 'off'}`, INSPECT_OPTS)
|
|
39
|
+
airbrake._opt.errorNotifications = true
|
|
41
40
|
const res = await airbrake.notify({
|
|
42
41
|
error,
|
|
43
42
|
params: { consoleInvocationDetails: { method, arguments: { ...args.map(arg => inspect(arg, INSPECT_OPTS)) } } },
|