@hkdigital/lib-core 0.4.34 → 0.4.35
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.
|
@@ -212,7 +212,9 @@ export class ConsoleAdapter {
|
|
|
212
212
|
message: details.message,
|
|
213
213
|
stack: cleanedStack,
|
|
214
214
|
errorType: formatErrorDisplay(errorMeta),
|
|
215
|
-
...(relevantFrameIndex >= 0 && { relevantFrameIndex })
|
|
215
|
+
...(relevantFrameIndex >= 0 && { relevantFrameIndex }),
|
|
216
|
+
...('details' in details && { details: details.details }),
|
|
217
|
+
...('status' in details && { status: details.status })
|
|
216
218
|
};
|
|
217
219
|
}
|
|
218
220
|
} else if (details.error instanceof Error) {
|
|
@@ -233,7 +235,9 @@ export class ConsoleAdapter {
|
|
|
233
235
|
message: details.error.message,
|
|
234
236
|
stack: cleanedStack,
|
|
235
237
|
errorType: formatErrorDisplay(errorMeta),
|
|
236
|
-
...(relevantFrameIndex >= 0 && { relevantFrameIndex })
|
|
238
|
+
...(relevantFrameIndex >= 0 && { relevantFrameIndex }),
|
|
239
|
+
...('details' in details.error && { details: details.error.details }),
|
|
240
|
+
...('status' in details.error && { status: details.error.status })
|
|
237
241
|
};
|
|
238
242
|
}
|
|
239
243
|
// Include other details except the error
|
|
@@ -200,6 +200,10 @@ export default class Logger extends EventEmitter {
|
|
|
200
200
|
// Log without message
|
|
201
201
|
return this.#log(ERROR, errorObject.message, errorObject);
|
|
202
202
|
}
|
|
203
|
+
// else if( message ) {
|
|
204
|
+
// // Only log message, no Error object supplied
|
|
205
|
+
// return this.#log(ERROR, message);
|
|
206
|
+
// }
|
|
203
207
|
else {
|
|
204
208
|
// Missing error like object
|
|
205
209
|
// => invalid parameters supplied to logger.error
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
import { EventEmitter } from '../../generic/events.js';
|
|
67
67
|
import { Logger, DEBUG, INFO } from '../../logging/index.js';
|
|
68
68
|
|
|
69
|
-
import {
|
|
70
|
-
SERVICE_LOG,
|
|
69
|
+
import {
|
|
70
|
+
SERVICE_LOG,
|
|
71
71
|
STATE_CHANGED,
|
|
72
72
|
HEALTH_CHANGED,
|
|
73
73
|
ERROR,
|
|
@@ -298,9 +298,10 @@ export class ServiceManager extends EventEmitter {
|
|
|
298
298
|
this.logger.debug(`Starting dependency '${dep}' for '${name}'`);
|
|
299
299
|
|
|
300
300
|
const started = await this.startService(dep);
|
|
301
|
+
|
|
301
302
|
if (!started) {
|
|
302
303
|
this.logger.error(
|
|
303
|
-
`Failed to start dependency '${dep}' for '${name}'`
|
|
304
|
+
new Error(`Failed to start dependency '${dep}' for '${name}'`)
|
|
304
305
|
);
|
|
305
306
|
return false;
|
|
306
307
|
}
|
|
@@ -396,14 +397,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
396
397
|
results.set(name, success);
|
|
397
398
|
|
|
398
399
|
if (!success) {
|
|
399
|
-
|
|
400
|
-
// Mark remaining services as not started
|
|
401
|
-
for (const remaining of sorted) {
|
|
402
|
-
if (!results.has(remaining)) {
|
|
403
|
-
results.set(remaining, false);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
break;
|
|
400
|
+
throw new Error(`Failed to start service [${name}], stopping`);
|
|
407
401
|
}
|
|
408
402
|
}
|
|
409
403
|
|
|
@@ -430,7 +424,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
430
424
|
const results = new Map();
|
|
431
425
|
|
|
432
426
|
// Handle global timeout if specified
|
|
433
|
-
if (stopOptions.timeout
|
|
427
|
+
if (stopOptions.timeout) {
|
|
434
428
|
const timeoutPromise = new Promise((_, reject) =>
|
|
435
429
|
setTimeout(
|
|
436
430
|
() => reject(new Error('Global shutdown timeout')),
|
|
@@ -445,8 +439,10 @@ export class ServiceManager extends EventEmitter {
|
|
|
445
439
|
timeoutPromise
|
|
446
440
|
]);
|
|
447
441
|
} catch (error) {
|
|
448
|
-
if (
|
|
449
|
-
|
|
442
|
+
if (
|
|
443
|
+
/** @type {Error} */ (error).message === 'Global shutdown timeout'
|
|
444
|
+
) {
|
|
445
|
+
this.logger.error( new Error('Global shutdown timeout reached' ) );
|
|
450
446
|
// Mark any remaining services as failed
|
|
451
447
|
for (const name of sorted) {
|
|
452
448
|
if (!results.has(name)) {
|