Commit baac022 1 parent 585bfb9 commit baac022 Copy full SHA for baac022
File tree 1 file changed +19
-1
lines changed
packages/wizard/src/utils/internals
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,27 @@ export const middlewareActions = createActions(
68
68
const nextSymbol = Symbol ( 'next-middleware' )
69
69
const settings = context . api . middleware . settings
70
70
71
+ if ( typeof settings . middlewareSchemas !== 'object' ) {
72
+ ProjectError . create (
73
+ wizardTags . middleware ,
74
+ 'There is no middleware initialized' ,
75
+ context . $cause
76
+ ) . throw ( )
77
+ }
78
+
71
79
const shareKeys : string [ ] = middlewares . flatMap ( middleware => {
72
80
if ( typeof middleware === 'string' ) {
73
- return settings . middlewareSchemas [ middleware ] . share
81
+ const middlewareSchema = settings . middlewareSchemas [ middleware ]
82
+
83
+ if ( ! middlewareSchema ) {
84
+ ProjectError . create (
85
+ wizardTags . middleware ,
86
+ `There is no middleware initialized with the name '${ middleware } '` ,
87
+ context . $cause
88
+ ) . throw ( )
89
+ }
90
+
91
+ return middlewareSchema . share
74
92
}
75
93
return middleware . share
76
94
} )
You can’t perform that action at this time.
0 commit comments