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.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index aafc9723e..b560e2fe4 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -45,8 +45,19 @@ export class RestExtractor {
45 errorMessage = err.error.message 45 errorMessage = err.error.message
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 const body = err.error 48 // A server-side error occurred.
49 errorMessage = body ? body.error : 'Unknown error.' 49 // TODO: remove when angular/angular#19477 (comment) is fixed
50 let body = JSON.parse(err.error)
51 if (body) {
52 if (body.errors) {
53 const errors = body.errors
54 const error = errors[Object.keys(errors)[0]]
55 errorMessage = error.msg // Take the message of the first error
56 } else if (body.error) {
57 errorMessage = body.error
58 }
59 }
60 errorMessage = errorMessage ? errorMessage : 'Unknown error.'
50 console.error(`Backend returned code ${err.status}, body was: ${errorMessage}`) 61 console.error(`Backend returned code ${err.status}, body was: ${errorMessage}`)
51 } else { 62 } else {
52 errorMessage = err 63 errorMessage = err