mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-04 05:08:06 +02:00
re-assign concated errors
This commit is contained in:
parent
50d242e53a
commit
5c7a911b2e
@ -11,14 +11,14 @@ export class ValidationService {
|
|||||||
|
|
||||||
showError(data: any): string[] {
|
showError(data: any): string[] {
|
||||||
const defaultErrorMessage = this.i18nService.t('unexpectedError');
|
const defaultErrorMessage = this.i18nService.t('unexpectedError');
|
||||||
const errors: string[] = [];
|
let errors: string[] = [];
|
||||||
|
|
||||||
if (data != null && typeof data === 'string') {
|
if (data != null && typeof data === 'string') {
|
||||||
errors.push(data);
|
errors.push(data);
|
||||||
} else if (data == null || typeof data !== 'object') {
|
} else if (data == null || typeof data !== 'object') {
|
||||||
errors.push(defaultErrorMessage);
|
errors.push(defaultErrorMessage);
|
||||||
} else if (data.validationErrors != null) {
|
} else if (data.validationErrors != null) {
|
||||||
errors.concat((data as ErrorResponse).getAllMessages());
|
errors = errors.concat((data as ErrorResponse).getAllMessages());
|
||||||
} else {
|
} else {
|
||||||
errors.push(data.message ? data.message : defaultErrorMessage);
|
errors.push(data.message ? data.message : defaultErrorMessage);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user