Skip to content

Commit 027090a

Browse files
committed
Fix angular error messages
1 parent 0a0fbc3 commit 027090a

15 files changed

Lines changed: 172 additions & 64 deletions

File tree

src/Exceptionless.Web/ClientApp.angular/app/account/manage-controller.js

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@
4141
function authenticate(provider) {
4242
function onFailure(response) {
4343
var message = translateService.T("An error occurred while adding external login.");
44-
if (response.data && response.data.message) {
45-
message += " " + translateService.T("Message:") + " " + response.data.message;
44+
if (response.data && (response.data.message || response.data.title)) {
45+
message +=
46+
" " +
47+
translateService.T("Message:") +
48+
" " +
49+
(response.data.message || response.data.title);
4650
}
4751

4852
notificationService.error(message);
@@ -65,8 +69,12 @@
6569

6670
function onFailure(response) {
6771
var message = translateService.T("An error occurred while trying to change your password.");
68-
if (response.data && response.data.message) {
69-
message += " " + translateService.T("Message:") + " " + response.data.message;
72+
if (response.data && (response.data.message || response.data.title)) {
73+
message +=
74+
" " +
75+
translateService.T("Message:") +
76+
" " +
77+
(response.data.message || response.data.title);
7078
}
7179

7280
notificationService.error(message);
@@ -141,8 +149,12 @@
141149

142150
function onFailure(response) {
143151
var message = translateService.T("An error occurred while loading your user profile.");
144-
if (response.data && response.data.message) {
145-
message += " " + translateService.T("Message:") + " " + response.data.message;
152+
if (response.data && (response.data.message || response.data.title)) {
153+
message +=
154+
" " +
155+
translateService.T("Message:") +
156+
" " +
157+
(response.data.message || response.data.title);
146158
}
147159

148160
notificationService.error(message);
@@ -167,7 +179,7 @@
167179
notificationService.error(
168180
translateService.T("An error occurred while trying remove your user account.") +
169181
" " +
170-
response.data.message
182+
((response.data && (response.data.message || response.data.title)) || "")
171183
);
172184
}
173185

@@ -202,8 +214,12 @@
202214
function resendVerificationEmail() {
203215
function onFailure(response) {
204216
var message = translateService.T("An error occurred while sending your verification email.");
205-
if (response.data && response.data.message) {
206-
message += " " + translateService.T("Message:") + " " + response.data.message;
217+
if (response.data && (response.data.message || response.data.title)) {
218+
message +=
219+
" " +
220+
translateService.T("Message:") +
221+
" " +
222+
(response.data.message || response.data.title);
207223
}
208224

209225
notificationService.error(message);
@@ -245,8 +261,12 @@
245261

246262
function onFailure(response) {
247263
var message = translateService.T("An error occurred while saving your email address.");
248-
if (response.data && response.data.message) {
249-
message += " " + translateService.T("Message:") + " " + response.data.message;
264+
if (response.data && (response.data.message || response.data.title)) {
265+
message +=
266+
" " +
267+
translateService.T("Message:") +
268+
" " +
269+
(response.data.message || response.data.title);
250270
}
251271

252272
notificationService.error(message);
@@ -261,8 +281,12 @@
261281
function saveEmailNotificationSettings() {
262282
function onFailure(response) {
263283
var message = translateService.T("An error occurred while saving your notification settings.");
264-
if (response.data && response.data.message) {
265-
message += " " + translateService.T("Message:") + " " + response.data.message;
284+
if (response.data && (response.data.message || response.data.title)) {
285+
message +=
286+
" " +
287+
translateService.T("Message:") +
288+
" " +
289+
(response.data.message || response.data.title);
266290
}
267291

268292
notificationService.error(message);
@@ -278,8 +302,12 @@
278302
var message = translateService.T(
279303
"An error occurred while saving your email notification preferences."
280304
);
281-
if (response.data && response.data.message) {
282-
message += " " + translateService.T("Message:") + " " + response.data.message;
305+
if (response.data && (response.data.message || response.data.title)) {
306+
message +=
307+
" " +
308+
translateService.T("Message:") +
309+
" " +
310+
(response.data.message || response.data.title);
283311
}
284312

285313
notificationService.error(message);
@@ -297,8 +325,12 @@
297325

298326
function onFailure(response) {
299327
var message = translateService.T("An error occurred while saving your full name.");
300-
if (response.data && response.data.message) {
301-
message += " " + translateService.T("Message:") + " " + response.data.message;
328+
if (response.data && (response.data.message || response.data.title)) {
329+
message +=
330+
" " +
331+
translateService.T("Message:") +
332+
" " +
333+
(response.data.message || response.data.title);
302334
}
303335

304336
notificationService.error(message);
@@ -320,8 +352,12 @@
320352

321353
function onFailure(response) {
322354
var message = translateService.T("An error occurred while removing the external login.");
323-
if (response.data && response.data.message) {
324-
message += " " + translateService.T("Message:") + " " + response.data.message;
355+
if (response.data && (response.data.message || response.data.title)) {
356+
message +=
357+
" " +
358+
translateService.T("Message:") +
359+
" " +
360+
(response.data.message || response.data.title);
325361
}
326362

327363
notificationService.error(message);

src/Exceptionless.Web/ClientApp.angular/app/account/verify-controller.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737
.setProperty("response", response)
3838
.submit();
3939
var message = translateService.T("An error occurred while verifying your account.");
40-
if (response && response.data && response.data.message) {
41-
message += " " + translateService.T("Message:") + " " + response.data.message;
40+
if (response && response.data && (response.data.message || response.data.title)) {
41+
message +=
42+
" " +
43+
translateService.T("Message:") +
44+
" " +
45+
(response.data.message || response.data.title);
4246
}
4347

4448
notificationService.error(message);

src/Exceptionless.Web/ClientApp.angular/app/auth/forgot-password-controller.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
.setProperty("response", response)
2929
.submit();
3030
var message = translateService.T("ResetPassword_Failed_Message");
31-
if (response.data && response.data.message) {
32-
message += " " + translateService.T("Message:") + " " + response.data.message;
31+
if (response.data && (response.data.message || response.data.title)) {
32+
message +=
33+
" " +
34+
translateService.T("Message:") +
35+
" " +
36+
(response.data.message || response.data.title);
3337
}
3438

3539
notificationService.error(message);

src/Exceptionless.Web/ClientApp.angular/app/auth/login-controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
}
3030

3131
var message = translateService.T("Loggin_Failed_Message");
32-
if (response.data && response.data.message) {
33-
message += " " + translateService.T("Message:") + " " + response.data.message;
32+
if (response.data && (response.data.message || response.data.title)) {
33+
message +=
34+
" " + translateService.T("Message:") + " " + (response.data.message || response.data.title);
3435
} else if (response.status < 0) {
3536
return translateService.T("Unable_to_connect_to") + " " + BASE_URL + ".";
3637
}

src/Exceptionless.Web/ClientApp.angular/app/auth/reset-password-controller.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
.setProperty("response", response)
2929
.submit();
3030
var message = translateService.T("An error occurred while trying to change your password.");
31-
if (response.data && response.data.message) {
32-
message += " " + translateService.T("Message:") + " " + response.data.message;
31+
if (response.data && (response.data.message || response.data.title)) {
32+
message +=
33+
" " +
34+
translateService.T("Message:") +
35+
" " +
36+
(response.data.message || response.data.title);
3337
}
3438

3539
notificationService.error(message);

src/Exceptionless.Web/ClientApp.angular/app/auth/signup-controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
var message = translateService.T(
3030
"An error occurred while signing up. Please contact support for more information."
3131
);
32-
if (response.data && response.data.message) {
33-
message += " " + translateService.T("Message:") + " " + response.data.message;
32+
if (response.data && (response.data.message || response.data.title)) {
33+
message +=
34+
" " + translateService.T("Message:") + " " + (response.data.message || response.data.title);
3435
} else if (response.status < 0) {
3536
return translateService.T("Unable_to_connect_to") + " " + BASE_URL + ".";
3637
}

src/Exceptionless.Web/ClientApp.angular/app/event/event-controller.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,16 @@
467467

468468
function onFailure(response) {
469469
if (response && response.status === 426) {
470-
return billingService.confirmUpgradePlan(response.data.message).then(
471-
function () {
472-
return getEvent();
473-
},
474-
function () {
475-
$state.go("app.frequent");
476-
}
477-
);
470+
return billingService
471+
.confirmUpgradePlan(response.data && (response.data.message || response.data.title))
472+
.then(
473+
function () {
474+
return getEvent();
475+
},
476+
function () {
477+
$state.go("app.frequent");
478+
}
479+
);
478480
}
479481

480482
$state.go("app.frequent");

src/Exceptionless.Web/ClientApp.angular/app/organization/list/list-controller.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,20 @@
4848
function onFailure(response) {
4949
if (response.status === 426) {
5050
return billingService
51-
.confirmUpgradePlan(response.data.message)
51+
.confirmUpgradePlan(response.data && (response.data.message || response.data.title))
5252
.then(function () {
5353
return createOrganization(name);
5454
})
5555
.catch(function (e) {});
5656
}
5757

5858
var message = translateService.T("An error occurred while creating the organization.");
59-
if (response.data && response.data.message) {
60-
message += " " + translateService.T("Message:") + " " + response.data.message;
59+
if (response.data && (response.data.message || response.data.title)) {
60+
message +=
61+
" " +
62+
translateService.T("Message:") +
63+
" " +
64+
(response.data.message || response.data.title);
6165
}
6266

6367
notificationService.error(message);
@@ -114,8 +118,12 @@
114118
var message = translateService.T(
115119
"An error occurred while trying to leave the organization."
116120
);
117-
if (response.status === 400) {
118-
message += " " + translateService.T("Message:") + " " + response.data.message;
121+
if (response.status === 400 && response.data) {
122+
message +=
123+
" " +
124+
translateService.T("Message:") +
125+
" " +
126+
(response.data.message || response.data.title);
119127
}
120128

121129
notificationService.error(message);
@@ -187,8 +195,12 @@
187195
var message = translateService.T(
188196
"An error occurred while trying to delete the organization."
189197
);
190-
if (response.status === 400) {
191-
message += " " + translateService.T("Message:") + " " + response.data.message;
198+
if (response.status === 400 && response.data) {
199+
message +=
200+
" " +
201+
translateService.T("Message:") +
202+
" " +
203+
(response.data.message || response.data.title);
192204
}
193205

194206
$ExceptionlessClient

src/Exceptionless.Web/ClientApp.angular/app/organization/manage/manage-controller.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,23 @@
5454
function createUser(emailAddress) {
5555
function onFailure(response) {
5656
if (response.status === 426) {
57+
var upgradeMessage =
58+
(response.data && (response.data.message || response.data.title)) || undefined;
5759
return billingService
58-
.confirmUpgradePlan(response.data.message, vm._organizationId)
60+
.confirmUpgradePlan(upgradeMessage, vm._organizationId)
5961
.then(function () {
6062
return createUser(emailAddress);
6163
})
6264
.catch(function (e) {});
6365
}
6466

6567
var message = translateService.T("An error occurred while inviting the user.");
66-
if (response.data && response.data.message) {
67-
message += " " + translateService.T("Message:") + " " + response.data.message;
68+
if (response.data && (response.data.message || response.data.title)) {
69+
message +=
70+
" " +
71+
translateService.T("Message:") +
72+
" " +
73+
(response.data.message || response.data.title);
6874
}
6975

7076
notificationService.error(message);
@@ -175,8 +181,12 @@
175181
var message = translateService.T(
176182
"An error occurred while trying to leave the organization."
177183
);
178-
if (response.status === 400) {
179-
message += " " + translateService.T("Message:") + " " + response.data.message;
184+
if (response.status === 400 && response.data) {
185+
message +=
186+
" " +
187+
translateService.T("Message:") +
188+
" " +
189+
(response.data.message || response.data.title);
180190
}
181191

182192
notificationService.error(message);
@@ -211,8 +221,12 @@
211221
var message = translateService.T(
212222
"An error occurred while trying to delete the organization."
213223
);
214-
if (response.status === 400) {
215-
message += " " + translateService.T("Message:") + " " + response.data.message;
224+
if (response.status === 400 && response.data) {
225+
message +=
226+
" " +
227+
translateService.T("Message:") +
228+
" " +
229+
(response.data.message || response.data.title);
216230
}
217231

218232
notificationService.error(message);

0 commit comments

Comments
 (0)