Dedupe error messages

This commit is contained in:
Tobe O 2019-09-27 09:29:02 -04:00
parent 5d8c2ae005
commit b38905234c

View file

@ -382,10 +382,10 @@ class ValidationException extends AngelHttpException {
/// A descriptive message describing the error.
final String message;
ValidationException(this.message, {List<String> errors = const []})
ValidationException(this.message, {Iterable<String> errors = const []})
: super(FormatException(message),
statusCode: 400,
errors: errors ?? [],
errors: (errors ?? <String>[]).toSet().toList(),
stackTrace: StackTrace.current) {
if (errors != null) this.errors.addAll(errors);
}