File tree 1 file changed +4
-8
lines changed
packages/interactivity/src
1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -143,11 +143,13 @@ export function withScope( func: ( ...args: unknown[] ) => unknown ) {
143
143
const gen = func ( ...args ) as Generator ;
144
144
let value : any ;
145
145
let it : any ;
146
+ let error : any ;
146
147
while ( true ) {
147
148
setNamespace ( ns ) ;
148
149
setScope ( scope ) ;
149
150
try {
150
- it = gen . next ( value ) ;
151
+ it = error ? gen . throw ( error ) : gen . next ( value ) ;
152
+ error = undefined ;
151
153
} finally {
152
154
resetScope ( ) ;
153
155
resetNamespace ( ) ;
@@ -156,14 +158,8 @@ export function withScope( func: ( ...args: unknown[] ) => unknown ) {
156
158
try {
157
159
value = await it . value ;
158
160
} catch ( e ) {
159
- setNamespace ( ns ) ;
160
- setScope ( scope ) ;
161
- gen . throw ( e ) ;
162
- } finally {
163
- resetScope ( ) ;
164
- resetNamespace ( ) ;
161
+ error = e ;
165
162
}
166
-
167
163
if ( it . done ) {
168
164
break ;
169
165
}
You can’t perform that action at this time.
0 commit comments