88 InitContext ,
99 type LibraryHandle ,
1010 LibraryStatusEnum ,
11+ NfNotInitializedException ,
1112} from "@nanoforge/common" ;
1213
1314import { type ApplicationConfig } from "../application/application-config" ;
@@ -19,8 +20,8 @@ import { ConfigRegistry } from "../config/config-registry";
1920export class Core {
2021 private readonly config : ApplicationConfig ;
2122 private readonly context : ApplicationContext ;
22- private options : IApplicationOptions ;
23- private _configRegistry : ConfigRegistry ;
23+ private options ? : IApplicationOptions ;
24+ private _configRegistry ? : ConfigRegistry ;
2425
2526 constructor ( config : ApplicationConfig , context : ApplicationContext ) {
2627 this . config = config ;
@@ -34,6 +35,8 @@ export class Core {
3435 }
3536
3637 public async run ( ) : Promise < void > {
38+ if ( ! this . options ) throw new NfNotInitializedException ( "Core" ) ;
39+
3740 const context = this . getExecutionContext ( ) ;
3841 const clientContext = this . getClientContext ( ) ;
3942 const libraries = this . config . libraryManager . getExecutionLibraries ( ) ;
@@ -65,6 +68,8 @@ export class Core {
6568 }
6669
6770 private getInitContext ( options : IRunOptions ) : InitContext {
71+ if ( ! this . _configRegistry ) throw new NfNotInitializedException ( "Core" ) ;
72+
6873 return new InitContext ( this . context , this . config . libraryManager , this . _configRegistry , options ) ;
6974 }
7075
0 commit comments