@defra-fish/connectors-lib 1.64.0 → 1.65.0-airbrake-debugging

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 +2 -3
  2. package/src/airbrake.js +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/connectors-lib",
3
- "version": "1.64.0",
3
+ "version": "1.65.0-airbrake-debugging",
4
4
  "description": "Shared connectors",
5
5
  "type": "module",
6
6
  "engines": {
@@ -45,6 +45,5 @@
45
45
  "ioredis": "4.28.5",
46
46
  "node-fetch": "2.7.0",
47
47
  "redlock": "4.2.0"
48
- },
49
- "gitHead": "d6a3d30c7a20169fdf5afb1a93eb1d411fe96abf"
48
+ }
50
49
  }
package/src/airbrake.js CHANGED
@@ -1,5 +1,7 @@
1
+ import db from 'debug'
1
2
  import { Notifier } from '@airbrake/node'
2
3
  import { formatWithOptions, inspect } from 'util'
4
+ const debug = db('connectors:airbrake')
3
5
  const INSPECT_OPTS = { depth: null, maxStringLength: null, maxArrayLength: null, breakLength: null, compact: true, showHidden: true }
4
6
 
5
7
  let airbrake = null
@@ -55,6 +57,7 @@ export const initialise = () => {
55
57
 
56
58
  // Override the @airbrake/node uncaughtException/unhandledRejection handlers with our own as errors were not flushing correctly.
57
59
  const flushAndDie = async () => {
60
+ debug('Airbrake connector flushing and dying...')
58
61
  await airbrake.flush()
59
62
  process.exit(1)
60
63
  }
@@ -71,6 +74,7 @@ export const initialise = () => {
71
74
  */
72
75
  export const flush = async () => {
73
76
  if (initialise()) {
77
+ debug('Airbrake connector flushing...')
74
78
  await airbrake.flush()
75
79
  airbrake.close()
76
80
  }