You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
928 B

import { Service } from '../../../di/src/decorator/Service.ts'
import { Logging } from '../service/logging/Logging.ts'
import Unit from './Unit.ts'
import { container, make } from '../../../di/src/global.ts'
import { DependencyKey } from '../../../di/src/type/DependencyKey.ts'
import RunLevelErrorHandler from '../error/RunLevelErrorHandler.ts'
@Service()
export default class Application {
constructor(
protected logger: Logging,
protected rleh: RunLevelErrorHandler,
protected units: Unit[],
) {}
make(token: DependencyKey) {
return make(token)
}
container() {
return container
}
async up() {
}
async down() {
}
async run() {
try {
this.logger.info('Starting Daton...')
} catch (e) {
await this.app_error(e)
}
}
async app_error(e: Error) {
this.rleh.handle(e)
}
}