File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/components/product-progress Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -152,17 +152,21 @@ export class ProductProgressService {
152
152
) ;
153
153
}
154
154
155
- input . steps . forEach ( ( step , index ) => {
155
+ const errors = input . steps . flatMap ( ( step , index ) => {
156
156
if ( ! scope . steps . includes ( step . step ) ) {
157
- throw new StepNotPlannedException ( input . productId , step . step , index ) ;
157
+ return new StepNotPlannedException ( input . productId , step . step , index ) ;
158
158
}
159
159
if ( step . completed && step . completed > scope . progressTarget ) {
160
- throw new InputException (
160
+ return new InputException (
161
161
"Completed value cannot exceed product's progress target" ,
162
162
`steps.${ index } .completed` ,
163
163
) ;
164
164
}
165
+ return [ ] ;
165
166
} ) ;
167
+ if ( errors . length > 0 ) {
168
+ throw new AggregateError ( errors ) ;
169
+ }
166
170
167
171
const progress = await this . repo . update ( input ) ;
168
172
return this . secure ( progress , this . privilegesFor ( session , scope ) ) ! ;
You can’t perform that action at this time.
0 commit comments