File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,10 @@ export class Validator {
69
69
/**
70
70
* Performs validation of the given object based on decorators or validation schema and reject on error.
71
71
*/
72
- validateOrReject ( objectOrSchemaName : Object | string , objectOrValidationOptions : Object | ValidationOptions , maybeValidatorOptions ?: ValidatorOptions ) : Promise < void > {
73
- return this . coreValidate ( objectOrSchemaName , objectOrValidationOptions , maybeValidatorOptions )
74
- . then ( ( validationErorrs : ValidationError [ ] ) => ( validationErorrs . length > 0 ) ? Promise . reject ( validationErorrs ) : Promise . resolve ( ) ) ;
72
+ async validateOrReject ( objectOrSchemaName : Object | string , objectOrValidationOptions : Object | ValidationOptions , maybeValidatorOptions ?: ValidatorOptions ) : Promise < void > {
73
+ const errors = await this . coreValidate ( objectOrSchemaName , objectOrValidationOptions , maybeValidatorOptions ) ;
74
+ if ( errors . length )
75
+ return Promise . reject ( errors ) ;
75
76
}
76
77
77
78
/**
You can’t perform that action at this time.
0 commit comments