diff --git a/package-lock.json b/package-lock.json index 199787e..0b02db9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -525,6 +525,7 @@ }, "node_modules/@eslint/config-array": { "version": "0.18.0", + "dev": true, "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.4", @@ -537,6 +538,7 @@ }, "node_modules/@eslint/config-array/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -545,6 +547,7 @@ }, "node_modules/@eslint/config-array/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -555,6 +558,7 @@ }, "node_modules/@eslint/eslintrc": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", @@ -576,6 +580,7 @@ }, "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -584,6 +589,7 @@ }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -594,6 +600,7 @@ }, "node_modules/@eslint/js": { "version": "9.9.1", + "dev": true, "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -601,6 +608,7 @@ }, "node_modules/@eslint/object-schema": { "version": "2.1.4", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -670,6 +678,7 @@ }, "node_modules/@humanwhocodes/retry": { "version": "0.3.0", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=18.18" @@ -2413,6 +2422,7 @@ }, "node_modules/eslint": { "version": "9.9.1", + "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -2480,6 +2490,7 @@ }, "node_modules/eslint-scope": { "version": "8.0.2", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -2504,6 +2515,7 @@ }, "node_modules/eslint/node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -2512,6 +2524,7 @@ }, "node_modules/eslint/node_modules/eslint-visitor-keys": { "version": "4.0.0", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2522,6 +2535,7 @@ }, "node_modules/eslint/node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -2532,6 +2546,7 @@ }, "node_modules/espree": { "version": "10.1.0", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.12.0", @@ -2547,6 +2562,7 @@ }, "node_modules/espree/node_modules/eslint-visitor-keys": { "version": "4.0.0", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2731,6 +2747,7 @@ }, "node_modules/file-entry-cache": { "version": "8.0.0", + "dev": true, "license": "MIT", "dependencies": { "flat-cache": "^4.0.0" @@ -2783,6 +2800,7 @@ }, "node_modules/flat-cache": { "version": "4.0.1", + "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", @@ -2946,6 +2964,7 @@ }, "node_modules/globals": { "version": "14.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=18" @@ -4472,17 +4491,6 @@ "rdf-terms": "^1.7.0" } }, - "node_modules/rdf-js": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/rdf-js/-/rdf-js-4.0.2.tgz", - "integrity": "sha512-ApvlFa/WsQh8LpPK/6hctQwG06Z9ztQQGWVtrcrf9L6+sejHNXLPOqL+w7q3hF+iL0C4sv3AX1PUtGkLNzyZ0Q==", - "deprecated": "Use @types/rdf-js instead. See https://github.com/rdfjs/types?tab=readme-ov-file#what-about-typesrdf-js", - "license": "MIT", - "peer": true, - "dependencies": { - "@rdfjs/types": "*" - } - }, "node_modules/rdf-lens": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rdf-lens/-/rdf-lens-1.3.0.tgz", diff --git a/src/exitHandler.ts b/src/exitHandler.ts index 1b9f209..74210d8 100644 --- a/src/exitHandler.ts +++ b/src/exitHandler.ts @@ -11,12 +11,18 @@ export function Cleanup(callback: () => void | Promise) { // Make sure we only call the callback once. let callbackCalled = false; - const fn = async function (event: string, code?: number) { + const fn = async function (event: string, code?: number, message?: Error) { if (!callbackCalled) { callbackCalled = true; logger.debug( `[Cleanup] Callback called on '${event}' with code '${code}'.`, ); + if (message) { + logger.error( + `[Cleanup] Uncaught Exception: ${message.name} - ${message.message}`, + ); + logger.debug(message.stack); + } await callback(); } else { logger.debug( @@ -41,6 +47,6 @@ export function Cleanup(callback: () => void | Promise) { //catch uncaught exceptions, trace, then exit normally process.on( "uncaughtException", - async () => await fn("uncaughtException", 99), + async (error) => await fn("uncaughtException", 99, error), ); }