Skip to content

Commit feb04a9

Browse files
committed
fix(@angular-devkit/architect): propagate option validation errors
By using the `SchemaValidationException` object, the underlying JSON schema validation errors will be propagated to the consuming code. This allows for more detailed error reporting of malformed or incorrectly provided options. Partially addresses angular#14269
1 parent 5b4b78b commit feb04a9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/angular_devkit/architect/src/architect.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function _createJobHandlerFromBuilderInfo(
5555
if (result.success) {
5656
return { ...v, options: result.data } as BuilderInput;
5757
} else if (result.errors) {
58-
throw new Error('Options did not validate.' + result.errors.join());
58+
throw new json.schema.SchemaValidationException(result.errors);
5959
} else {
6060
return v;
6161
}
@@ -282,9 +282,7 @@ function _validateOptionsFactory(host: ArchitectHost, registry: json.schema.Sche
282282
if (success) {
283283
return of(data as json.JsonObject);
284284
} else {
285-
throw new Error(
286-
'Data did not validate: ' + (errors ? errors.join() : 'Unknown error.'),
287-
);
285+
throw new json.schema.SchemaValidationException(errors);
288286
}
289287
}),
290288
).toPromise();

0 commit comments

Comments
 (0)