@defra-fish/connectors-lib 1.63.0-debug-airbrake-failure-5 → 1.63.0-debug-airbrake-failure-7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/airbrake.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/connectors-lib",
3
- "version": "1.63.0-debug-airbrake-failure-5",
3
+ "version": "1.63.0-debug-airbrake-failure-7",
4
4
  "description": "Shared connectors",
5
5
  "type": "module",
6
6
  "engines": {
package/src/airbrake.js CHANGED
@@ -25,7 +25,8 @@ export const initialise = () => {
25
25
  performanceStats: false,
26
26
  instrumentation: {
27
27
  fetch: false
28
- }
28
+ },
29
+ errorNotifications: true
29
30
  })
30
31
 
31
32
  // Proxy the console.warn and console.error methods, notifying airbrake/errbit asynchronously
@@ -33,11 +34,11 @@ export const initialise = () => {
33
34
  ;['warn', 'error'].forEach(method => {
34
35
  console.log(`replacing console.${method} function`)
35
36
  nativeConsoleMethods[method] = console[method].bind(console)
36
- console[method] = (...args) => {
37
+ console[method] = async (...args) => {
37
38
  const error = args.find(arg => arg instanceof Error) ?? new Error(formatWithOptions(INSPECT_OPTS, ...args))
38
39
  const request = args.find(arg => Object.prototype.hasOwnProperty.call(arg, 'headers'))
39
40
  console.log(`notifying airbrake for console.${method}`, INSPECT_OPTS)
40
- const res = airbrake.notify({
41
+ const res = await airbrake.notify({
41
42
  error,
42
43
  params: { consoleInvocationDetails: { method, arguments: { ...args.map(arg => inspect(arg, INSPECT_OPTS)) } } },
43
44
  environment: {
@@ -50,7 +51,7 @@ export const initialise = () => {
50
51
  ...(request?.headers?.['user-agent'] && { userAgent: request?.headers?.['user-agent'] })
51
52
  }
52
53
  })
53
- console.log(`Notify result: ${JSON.stringify(res)}`)
54
+ console.log(`Notify result: ${JSON.stringify(res)}`, res.id, res.url, res.error)
54
55
  nativeConsoleMethods[method](...args)
55
56
  }
56
57
  })