Better RLEH logic for error wraps; ability to hide "Starting..." message
This commit is contained in:
parent
be32976498
commit
a93cd6d192
@ -54,6 +54,8 @@ export class Application extends Container {
|
|||||||
protected applicationUnits: (typeof Unit)[] = []
|
protected applicationUnits: (typeof Unit)[] = []
|
||||||
protected instantiatedUnits: Unit[] = []
|
protected instantiatedUnits: Unit[] = []
|
||||||
|
|
||||||
|
public forceStartupMessage: boolean = true
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
@ -70,6 +72,10 @@ export class Application extends Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public hasUnit(unitClass: typeof Unit) {
|
||||||
|
return this.applicationUnits.includes(unitClass)
|
||||||
|
}
|
||||||
|
|
||||||
get root() {
|
get root() {
|
||||||
return this.basePath.concat()
|
return this.basePath.concat()
|
||||||
}
|
}
|
||||||
@ -150,7 +156,7 @@ export class Application extends Container {
|
|||||||
async up() {
|
async up() {
|
||||||
const logging: Logging = this.make<Logging>(Logging)
|
const logging: Logging = this.make<Logging>(Logging)
|
||||||
|
|
||||||
logging.info('Starting Extollo...', true)
|
logging.info('Starting Extollo...', this.forceStartupMessage)
|
||||||
for ( const unitClass of this.applicationUnits ) {
|
for ( const unitClass of this.applicationUnits ) {
|
||||||
const unit: Unit = this.make<Unit>(unitClass)
|
const unit: Unit = this.make<Unit>(unitClass)
|
||||||
this.instantiatedUnits.push(unit)
|
this.instantiatedUnits.push(unit)
|
||||||
@ -161,8 +167,8 @@ export class Application extends Container {
|
|||||||
async down() {
|
async down() {
|
||||||
const logging: Logging = this.make<Logging>(Logging)
|
const logging: Logging = this.make<Logging>(Logging)
|
||||||
|
|
||||||
logging.info('Stopping Extollo...', true)
|
logging.info('Stopping Extollo...', this.forceStartupMessage)
|
||||||
for ( const unit of this.instantiatedUnits ) {
|
for ( const unit of [...this.instantiatedUnits].reverse() ) {
|
||||||
if ( !unit ) continue
|
if ( !unit ) continue
|
||||||
await this.stopUnit(unit)
|
await this.stopUnit(unit)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ export class RunLevelErrorHandler {
|
|||||||
const error = new ErrorWithContext(e.message)
|
const error = new ErrorWithContext(e.message)
|
||||||
error.originalError = e
|
error.originalError = e
|
||||||
error.context = context
|
error.context = context
|
||||||
|
error.stack = e.stack
|
||||||
return error
|
return error
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ ${color.bgRed(' ')}
|
|||||||
${color.bgRed(' UNCAUGHT RUN-LEVEL ERROR ')}
|
${color.bgRed(' UNCAUGHT RUN-LEVEL ERROR ')}
|
||||||
${color.bgRed(' ')}
|
${color.bgRed(' ')}
|
||||||
|
|
||||||
${e.constructor ? e.constructor.name : e.name}
|
${operativeError.constructor ? operativeError.constructor.name : operativeError.name}
|
||||||
${color.red(`---------------------------------------------------`)}
|
${color.red(`---------------------------------------------------`)}
|
||||||
${e.stack}
|
${operativeError.stack}
|
||||||
`
|
`
|
||||||
|
|
||||||
if ( contextDisplay ) {
|
if ( contextDisplay ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user