Skip to content

Commit

Permalink
Code review changes part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Mar 24, 2020
1 parent b0af085 commit cb21e15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion lib/validation/ValidationError.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ValidationError extends Error {
* ValidationError
*
* @const
* @default
* @type {string}
* @readonly
* @public
*/
Expand All @@ -29,7 +31,7 @@ class ValidationError extends Error {
this.errors = ValidationError.filterErrors(errors);

/**
* Error message
* Formatted error message
*
* @type {string}
* @readonly
Expand Down
11 changes: 5 additions & 6 deletions lib/validation/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ class Validator {
project,
yaml
});
} else {
return undefined;
}
}
}
Expand All @@ -73,12 +71,13 @@ module.exports = {
* @param {string} options.yaml.source Content of the YAML file
* @param {number} [options.yaml.documentIndex=0] Document index in case the YAML file contains multiple documents
* @throws {module:@ui5/project.validation.ValidationError}
* Throws a {@link module:@ui5/project.validation.ValidationError ValidationError} when the validation fails.
* @returns {undefined} Returns when the validation succeeds
* Rejects with a {@link module:@ui5/project.validation.ValidationError ValidationError}
* when the validation fails.
* @returns {Promise<undefined>} Returns a Promise that resolves when the validation succeeds
* @public
*/
validate: (options) => {
return validator.validate(options);
validate: async (options) => {
await validator.validate(options);
},
_Validator: Validator // For testing only
};
2 changes: 1 addition & 1 deletion test/lib/projectPreprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ metadata:
},
yaml: {
documentIndex: 0,
path: "/application/ui5.yaml",
path: configPath,
source: ui5yaml,
},
}],
Expand Down

0 comments on commit cb21e15

Please sign in to comment.