@@ -82,32 +82,39 @@ private bool InternalEnforce<TRequest, TPolicy>(in EnforceContext context, in TR
82
82
83
83
if ( context . View . HasPolicyParameter && session . HasNextPolicy )
84
84
{
85
- int policyIndex = 0 ;
86
- while ( scanner . GetNext ( out IPolicyValues outValues ) )
85
+ try
87
86
{
88
- TPolicy policyValues = ( TPolicy ) outValues ;
89
- session . PolicyIndex = policyIndex ;
90
-
91
- HandleBeforeExpression ( in context , ref session , in effectChain , in requestValues , policyValues ) ;
92
- session . ExpressionResult = expressionHandler . Invoke ( in context , session . ExpressionString ,
93
- in requestValues , in policyValues ) ;
94
-
95
- if ( session . IsChainEffector )
96
- {
97
- HandleExpressionResult ( in context , ref session , ref effectChain , in requestValues , policyValues ) ;
98
- }
99
- else
100
- {
101
- HandleExpressionResult ( in context , ref session , Effector , in requestValues , policyValues ) ;
102
- }
103
-
104
- if ( session . Determined )
87
+ int policyIndex = 0 ;
88
+ while ( scanner . GetNext ( out IPolicyValues outValues ) )
105
89
{
106
- scanner . Interrupt ( ) ;
107
- break ;
90
+ TPolicy policyValues = ( TPolicy ) outValues ;
91
+ session . PolicyIndex = policyIndex ;
92
+
93
+ HandleBeforeExpression ( in context , ref session , in effectChain , in requestValues , policyValues ) ;
94
+ session . ExpressionResult = expressionHandler . Invoke ( in context , session . ExpressionString ,
95
+ in requestValues , in policyValues ) ;
96
+
97
+ if ( session . IsChainEffector )
98
+ {
99
+ HandleExpressionResult ( in context , ref session , ref effectChain , in requestValues , policyValues ) ;
100
+ }
101
+ else
102
+ {
103
+ HandleExpressionResult ( in context , ref session , Effector , in requestValues , policyValues ) ;
104
+ }
105
+
106
+ if ( session . Determined )
107
+ {
108
+ scanner . Interrupt ( ) ;
109
+ break ;
110
+ }
111
+
112
+ policyIndex ++ ;
108
113
}
109
-
110
- policyIndex ++ ;
114
+ }
115
+ finally
116
+ {
117
+ scanner . Interrupt ( ) ;
111
118
}
112
119
}
113
120
else
0 commit comments