aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts21
1 files changed, 12 insertions, 9 deletions
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index b560e2fe4..59dea7880 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -46,15 +46,18 @@ export class RestExtractor {
46 console.error('An error occurred:', errorMessage) 46 console.error('An error occurred:', errorMessage)
47 } else if (err.status !== undefined) { 47 } else if (err.status !== undefined) {
48 // A server-side error occurred. 48 // A server-side error occurred.
49 // TODO: remove when angular/angular#19477 (comment) is fixed 49 if (err.error) {
50 let body = JSON.parse(err.error) 50 if (err.error.errors) {
51 if (body) { 51 const errors = err.error.errors
52 if (body.errors) { 52 const errorsArray: string[] = []
53 const errors = body.errors 53
54 const error = errors[Object.keys(errors)[0]] 54 Object.keys(errors).forEach(key => {
55 errorMessage = error.msg // Take the message of the first error 55 errorsArray.push(errors[key].msg)
56 } else if (body.error) { 56 })
57 errorMessage = body.error 57
58 errorMessage = errorsArray.join('. ')
59 } else if (err.error.error) {
60 errorMessage = err.error.error
58 } 61 }
59 } 62 }
60 errorMessage = errorMessage ? errorMessage : 'Unknown error.' 63 errorMessage = errorMessage ? errorMessage : 'Unknown error.'