diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-28 17:29:48 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-03-28 17:29:48 +0300 |
| commit | 5117c15b4856d6296b28e67e259c2ca1576b8794 (patch) | |
| tree | 1523ac54d9329371fb485de5eb34b6783ae1a719 /src/app/components/error-bar | |
| parent | b677348333ad26a2e02cfa2f2f6a65fd51a8517d (diff) | |
| download | DevHive-Angular-5117c15b4856d6296b28e67e259c2ca1576b8794.tar DevHive-Angular-5117c15b4856d6296b28e67e259c2ca1576b8794.tar.gz DevHive-Angular-5117c15b4856d6296b28e67e259c2ca1576b8794.zip | |
Improved how error-bar handles error messages
Diffstat (limited to 'src/app/components/error-bar')
| -rw-r--r-- | src/app/components/error-bar/error-bar.component.css | 2 | ||||
| -rw-r--r-- | src/app/components/error-bar/error-bar.component.ts | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/app/components/error-bar/error-bar.component.css b/src/app/components/error-bar/error-bar.component.css index 8f8edd9..880f205 100644 --- a/src/app/components/error-bar/error-bar.component.css +++ b/src/app/components/error-bar/error-bar.component.css @@ -5,6 +5,8 @@ color: white; padding: .2em; text-align: center; + word-wrap: break-word; + white-space: pre-wrap; } #error-bar:empty { diff --git a/src/app/components/error-bar/error-bar.component.ts b/src/app/components/error-bar/error-bar.component.ts index 111bac8..277552b 100644 --- a/src/app/components/error-bar/error-bar.component.ts +++ b/src/app/components/error-bar/error-bar.component.ts @@ -1,6 +1,5 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; -import { IApiError } from 'src/interfaces/api-error'; @Component({ selector: 'app-error-bar', @@ -18,14 +17,15 @@ export class ErrorBarComponent implements OnInit { } showError(error: HttpErrorResponse): void { - const test: IApiError = { - type: '', - title: 'Error!', - status: 0, - traceId: '' - }; - Object.assign(test, error.error); - this.errorMsg = test.title; + this.errorMsg = ''; + + const errors: string[][] = Object.values(Object.values(error.error)[0] as any); + + for (const errorArr of errors) { + for (const errorMsg of errorArr) { + this.errorMsg += errorMsg + '\n'; + } + } } hideError(): void { |
