aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-19 10:22:07 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-19 10:22:07 +0200
commit10db166bbe510af27cb20cc0f028537af0df9c41 (patch)
treedcffc4fe69f08043332009a7e8408d9b4f5da4bf /client/src/app/shared
parent8a02bd0433b7101c5ea36e87a4edb63204d2adec (diff)
downloadPeerTube-10db166bbe510af27cb20cc0f028537af0df9c41.tar.gz
PeerTube-10db166bbe510af27cb20cc0f028537af0df9c41.tar.zst
PeerTube-10db166bbe510af27cb20cc0f028537af0df9c41.zip
Upgrade client dependencies and fix error logs
Diffstat (limited to 'client/src/app/shared')
-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.'