File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ export const ObjectOSPlugin: ObjectQLPlugin = {
2323 } ) ;
2424 }
2525 } catch ( e ) {
26- console . error ( `Error loading app from ${ ctx . file } :` , e ) ;
26+ console . error ( `Error loading app from ${ ctx . file } : ${ e instanceof Error ? e . message : String ( e ) } ` ) ;
27+ console . error ( 'Expected YAML structure: { name: string, label: string, menu?: [...] }' ) ;
2728 }
2829 }
2930 } ) ;
@@ -46,10 +47,13 @@ export const ObjectOSPlugin: ObjectQLPlugin = {
4647 const config = entry . content as any ;
4748 config . data = data ;
4849 } else {
50+ const availableObjects = Array . from ( ( ctx . registry as any ) . store . get ( 'object' ) ?. keys ( ) || [ ] ) . join ( ', ' ) || 'none' ;
4951 console . warn ( `Found data for unknown object '${ objectName } ' in ${ ctx . file } ` ) ;
52+ console . warn ( `Ensure the corresponding ${ objectName } .object.yml file exists. Available objects: ${ availableObjects } ` ) ;
5053 }
5154 } catch ( e ) {
52- console . error ( `Error loading data from ${ ctx . file } :` , e ) ;
55+ console . error ( `Error loading data from ${ ctx . file } : ${ e instanceof Error ? e . message : String ( e ) } ` ) ;
56+ console . error ( 'Expected YAML structure: Array of objects with field values' ) ;
5357 }
5458 }
5559 } ) ;
Original file line number Diff line number Diff line change @@ -67,12 +67,23 @@ export const objectQLProvider: Provider = {
6767 } ) ;
6868 }
6969
70+ const presets = config . presets || [ '@objectos/preset-base' ] ;
71+
7072 const objectos = new ObjectOS ( {
7173 datasources,
72- presets : config . presets || [ '@objectos/preset-base' ]
74+ presets
7375 } ) ;
7476
75- await objectos . init ( ) ;
77+ try {
78+ await objectos . init ( ) ;
79+ } catch ( error ) {
80+ console . error ( 'Failed to initialize ObjectOS:' , error ) ;
81+ if ( error instanceof Error && error . message . includes ( 'preset' ) ) {
82+ console . error ( `Hint: Ensure preset packages are installed: ${ presets . join ( ', ' ) } ` ) ;
83+ }
84+ throw error ;
85+ }
86+
7687 return objectos ;
7788 }
7889} ;
You can’t perform that action at this time.
0 commit comments