aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-23 17:42:56 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-23 17:42:56 +0200
commitbf68dd752d6e3d5fce791dd8e0df9debb9d96902 (patch)
tree867e4bef8481b85e81193342922ec60430029838 /client
parentde59c48f5f317018e3f746bbe4a7b7efe00109f2 (diff)
downloadPeerTube-bf68dd752d6e3d5fce791dd8e0df9debb9d96902.tar.gz
PeerTube-bf68dd752d6e3d5fce791dd8e0df9debb9d96902.tar.zst
PeerTube-bf68dd752d6e3d5fce791dd8e0df9debb9d96902.zip
Client: fix error display for component
Diffstat (limited to 'client')
-rw-r--r--client/src/app/admin/users/shared/user.service.ts2
-rw-r--r--client/src/app/admin/users/user-add/user-add.component.ts2
-rw-r--r--client/src/app/admin/users/user-list/user-list.component.ts4
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts8
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts2
-rw-r--r--client/tsconfig.json7
7 files changed, 13 insertions, 14 deletions
diff --git a/client/src/app/admin/users/shared/user.service.ts b/client/src/app/admin/users/shared/user.service.ts
index d96db4575..13be553c0 100644
--- a/client/src/app/admin/users/shared/user.service.ts
+++ b/client/src/app/admin/users/shared/user.service.ts
@@ -20,7 +20,7 @@ export class UserService {
20 20
21 return this.authHttp.post(UserService.BASE_USERS_URL, body) 21 return this.authHttp.post(UserService.BASE_USERS_URL, body)
22 .map(this.restExtractor.extractDataBool) 22 .map(this.restExtractor.extractDataBool)
23 .catch((res) => this.restExtractor.handleError(res)); 23 .catch(this.restExtractor.handleError);
24 } 24 }
25 25
26 getUsers() { 26 getUsers() {
diff --git a/client/src/app/admin/users/user-add/user-add.component.ts b/client/src/app/admin/users/user-add/user-add.component.ts
index b7efd3a80..8dd98cc5c 100644
--- a/client/src/app/admin/users/user-add/user-add.component.ts
+++ b/client/src/app/admin/users/user-add/user-add.component.ts
@@ -31,7 +31,7 @@ export class UserAddComponent implements OnInit {
31 this.userService.addUser(this.username, this.password).subscribe( 31 this.userService.addUser(this.username, this.password).subscribe(
32 ok => this.router.navigate([ '/admin/users/list' ]), 32 ok => this.router.navigate([ '/admin/users/list' ]),
33 33
34 err => this.error = err 34 err => this.error = err.text
35 ); 35 );
36 } 36 }
37} 37}
diff --git a/client/src/app/admin/users/user-list/user-list.component.ts b/client/src/app/admin/users/user-list/user-list.component.ts
index 598daa42a..c89a61bca 100644
--- a/client/src/app/admin/users/user-list/user-list.component.ts
+++ b/client/src/app/admin/users/user-list/user-list.component.ts
@@ -27,7 +27,7 @@ export class UserListComponent implements OnInit {
27 this.totalUsers = totalUsers; 27 this.totalUsers = totalUsers;
28 }, 28 },
29 29
30 err => alert(err) 30 err => alert(err.text)
31 ); 31 );
32 } 32 }
33 33
@@ -37,7 +37,7 @@ export class UserListComponent implements OnInit {
37 this.userService.removeUser(user).subscribe( 37 this.userService.removeUser(user).subscribe(
38 () => this.getUsers(), 38 () => this.getUsers(),
39 39
40 err => alert(err) 40 err => alert(err.text)
41 ); 41 );
42 } 42 }
43 } 43 }
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index aa44799af..fcb1598f4 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -34,13 +34,19 @@ export class RestExtractor {
34 handleError(res: Response) { 34 handleError(res: Response) {
35 let text = 'Server error: '; 35 let text = 'Server error: ';
36 text += res.text(); 36 text += res.text();
37 let json = res.json(); 37 let json = '';
38
39 try {
40 json = res.json();
41 } catch (err) { ; }
38 42
39 const error = { 43 const error = {
40 json, 44 json,
41 text 45 text
42 }; 46 };
43 47
48 console.error(error);
49
44 return Observable.throw(error); 50 return Observable.throw(error);
45 } 51 }
46} 52}
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts
index 1324a6214..9a9ffe29f 100644
--- a/client/src/app/videos/video-list/video-list.component.ts
+++ b/client/src/app/videos/video-list/video-list.component.ts
@@ -98,7 +98,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
98 98
99 this.loading.next(false); 99 this.loading.next(false);
100 }, 100 },
101 error => alert(error) 101 error => alert(error.text)
102 ); 102 );
103 } 103 }
104 104
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index bc0e3157d..d260e55c7 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -86,7 +86,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
86 this.video = video; 86 this.video = video;
87 this.loadVideo(); 87 this.loadVideo();
88 }, 88 },
89 error => alert(error) 89 error => alert(error.text)
90 ); 90 );
91 }); 91 });
92 } 92 }
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 60ca14221..263316c4f 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -69,14 +69,8 @@
69 "src/app/shared/form-validators/url.validator.ts", 69 "src/app/shared/form-validators/url.validator.ts",
70 "src/app/shared/index.ts", 70 "src/app/shared/index.ts",
71 "src/app/shared/rest/index.ts", 71 "src/app/shared/rest/index.ts",
72 "src/app/shared/rest/mock-rest-table.ts",
73 "src/app/shared/rest/rest-extractor.service.ts", 72 "src/app/shared/rest/rest-extractor.service.ts",
74 "src/app/shared/rest/rest-filter.model.ts",
75 "src/app/shared/rest/rest-pagination.ts", 73 "src/app/shared/rest/rest-pagination.ts",
76 "src/app/shared/rest/rest-sort.ts",
77 "src/app/shared/rest/rest-table-page.ts",
78 "src/app/shared/rest/rest-table.spec.ts",
79 "src/app/shared/rest/rest-table.ts",
80 "src/app/shared/rest/rest.service.ts", 74 "src/app/shared/rest/rest.service.ts",
81 "src/app/shared/search/index.ts", 75 "src/app/shared/search/index.ts",
82 "src/app/shared/search/search-field.type.ts", 76 "src/app/shared/search/search-field.type.ts",
@@ -89,7 +83,6 @@
89 "src/app/videos/shared/index.ts", 83 "src/app/videos/shared/index.ts",
90 "src/app/videos/shared/loader/index.ts", 84 "src/app/videos/shared/loader/index.ts",
91 "src/app/videos/shared/loader/loader.component.ts", 85 "src/app/videos/shared/loader/loader.component.ts",
92 "src/app/videos/shared/pagination.model.ts",
93 "src/app/videos/shared/sort-field.type.ts", 86 "src/app/videos/shared/sort-field.type.ts",
94 "src/app/videos/shared/video.model.ts", 87 "src/app/videos/shared/video.model.ts",
95 "src/app/videos/shared/video.service.ts", 88 "src/app/videos/shared/video.service.ts",