Merge lp:~mikemc/ubuntuone-credentials/user-friendly-errors into lp:ubuntuone-credentials

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 67
Merged at revision: 66
Proposed branch: lp:~mikemc/ubuntuone-credentials/user-friendly-errors
Merge into: lp:ubuntuone-credentials
Diff against target: 65 lines (+10/-5)
4 files modified
libubuntuoneauth/errormessages.h (+3/-1)
libubuntuoneauth/network.cpp (+0/-2)
libubuntuoneauth/responses.h (+1/-1)
qml-credentials-service/ubuntuone_credentials_service.cpp (+6/-1)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-credentials/user-friendly-errors
Reviewer Review Type Date Requested Status
dobey (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+189192@code.launchpad.net

Commit message

- Provide general user-friendly error message for network errors. (LP: #1233951)

Description of the change

- Provide general user-friendly error message for network errors. (LP: #1233951)

You can test this on the desktop or device if you build and install, then run system-settings and try to create a u1 account with networking turned off.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntuoneauth/errormessages.h'
2--- libubuntuoneauth/errormessages.h 2013-06-14 22:30:19 +0000
3+++ libubuntuoneauth/errormessages.h 2013-10-03 23:17:33 +0000
4@@ -1,6 +1,9 @@
5 #ifndef ERROR_MESSAGES_H
6 #define ERROR_MESSAGES_H
7
8+
9+#define NO_HTTP_REASON "No HTTP error reason"
10+
11 #define LOGIN_FAILED "LOGIN_FAILED"
12 #define CAPTCHA_REQUIRED "CAPTCHA_REQUIRED"
13 #define INVALID_CREDENTIALS "INVALID_CREDENTIALS"
14@@ -11,7 +14,6 @@
15 #define CAN_NOT_RESET_PASSWORD "CAN_NOT_RESET_PASSWORD"
16 #define ALREADY_REGISTERED "ALREADY_REGISTERED"
17
18-
19 enum ErrorCodes
20 {
21 CODE_LOGIN_FAILED = 0,
22
23=== modified file 'libubuntuoneauth/network.cpp'
24--- libubuntuoneauth/network.cpp 2013-07-23 15:47:07 +0000
25+++ libubuntuoneauth/network.cpp 2013-10-03 23:17:33 +0000
26@@ -28,8 +28,6 @@
27 #include "responses.h"
28 #include "requests.h"
29
30-#define NO_HTTP_REASON QString("No HTTP error reason")
31-
32 namespace UbuntuOne {
33
34 Network::Network(QObject *parent)
35
36=== modified file 'libubuntuoneauth/responses.h'
37--- libubuntuoneauth/responses.h 2013-06-14 22:39:59 +0000
38+++ libubuntuoneauth/responses.h 2013-10-03 23:17:33 +0000
39@@ -131,4 +131,4 @@
40
41 } /* end UbuntuOne namespace */
42
43-#endif /* _REQUESTS_H_ */
44+#endif /* _RESPONSES_H_ */
45
46=== modified file 'qml-credentials-service/ubuntuone_credentials_service.cpp'
47--- qml-credentials-service/ubuntuone_credentials_service.cpp 2013-08-26 18:42:47 +0000
48+++ qml-credentials-service/ubuntuone_credentials_service.cpp 2013-10-03 23:17:33 +0000
49@@ -1,4 +1,5 @@
50 #include "ubuntuone_credentials_service.h"
51+#include "errormessages.h"
52 #include <QDebug>
53
54 UbuntuOneCredentialsService::UbuntuOneCredentialsService(QQuickItem *parent):
55@@ -153,5 +154,9 @@
56 void UbuntuOneCredentialsService::handleError(const ErrorResponse& error)
57 {
58 _state = IDLE;
59- emit loginOrRegisterError(error.message());
60+ if (error.httpStatus() == 0 || error.httpReason() == NO_HTTP_REASON) {
61+ emit loginOrRegisterError("Network error - please retry.");
62+ } else {
63+ emit loginOrRegisterError(error.message());
64+ }
65 }

Subscribers

People subscribed via source and target branches

to all changes: