Browse Source

Improved error display

Arnaud Vergnet 3 years ago
parent
commit
72c5a91f75

+ 7
- 0
src/components/Dialogs/ErrorDialog.js View File

28
             case ERROR_TYPE.NO_CONSENT:
28
             case ERROR_TYPE.NO_CONSENT:
29
                 this.message = i18n.t("errors.noConsent");
29
                 this.message = i18n.t("errors.noConsent");
30
                 break;
30
                 break;
31
+            case ERROR_TYPE.TOKEN_SAVE:
32
+                this.message = i18n.t("errors.tokenSave");
33
+                break;
34
+            case ERROR_TYPE.TOKEN_RETRIEVE:
35
+                this.message = i18n.t("errors.unknown");
36
+                break;
31
             case ERROR_TYPE.BAD_INPUT:
37
             case ERROR_TYPE.BAD_INPUT:
32
                 this.message = i18n.t("errors.badInput");
38
                 this.message = i18n.t("errors.badInput");
33
                 break;
39
                 break;
44
                 this.message = i18n.t("errors.unknown");
50
                 this.message = i18n.t("errors.unknown");
45
                 break;
51
                 break;
46
         }
52
         }
53
+        this.message += "\n\nCode " + this.props.errorCode;
47
     }
54
     }
48
 
55
 
49
     render() {
56
     render() {

+ 6
- 0
src/components/Screens/ErrorView.js View File

45
     constructor(props) {
45
     constructor(props) {
46
         super(props);
46
         super(props);
47
         this.colors = props.theme.colors;
47
         this.colors = props.theme.colors;
48
+        this.icon = "";
48
     }
49
     }
49
 
50
 
50
     generateMessage() {
51
     generateMessage() {
64
                     this.message = i18n.t("errors.noConsent");
65
                     this.message = i18n.t("errors.noConsent");
65
                     this.icon = "account-remove-outline";
66
                     this.icon = "account-remove-outline";
66
                     break;
67
                     break;
68
+                case ERROR_TYPE.TOKEN_SAVE:
69
+                    this.message = i18n.t("errors.tokenSave");
70
+                    this.icon = "alert-circle-outline";
71
+                    break;
67
                 case ERROR_TYPE.BAD_INPUT:
72
                 case ERROR_TYPE.BAD_INPUT:
68
                     this.message = i18n.t("errors.badInput");
73
                     this.message = i18n.t("errors.badInput");
69
                     this.icon = "alert-circle-outline";
74
                     this.icon = "alert-circle-outline";
85
                     this.icon = "alert-circle-outline";
90
                     this.icon = "alert-circle-outline";
86
                     break;
91
                     break;
87
             }
92
             }
93
+            this.message += "\n\nCode " + this.props.errorCode;
88
         } else {
94
         } else {
89
             this.message = this.props.message;
95
             this.message = this.props.message;
90
             this.icon = this.props.icon;
96
             this.icon = this.props.icon;

+ 2
- 2
src/managers/ConnectionManager.js View File

122
                             resolve(true);
122
                             resolve(true);
123
                         })
123
                         })
124
                         .catch(() => {
124
                         .catch(() => {
125
-                            reject(ERROR_TYPE.UNKNOWN);
125
+                            reject(ERROR_TYPE.TOKEN_SAVE);
126
                         });
126
                         });
127
                 })
127
                 })
128
                 .catch((error) => reject(error));
128
                 .catch((error) => reject(error));
151
                     .then((response) => resolve(response))
151
                     .then((response) => resolve(response))
152
                     .catch((error) => reject(error));
152
                     .catch((error) => reject(error));
153
             } else
153
             } else
154
-                reject(ERROR_TYPE.UNKNOWN);
154
+                reject(ERROR_TYPE.TOKEN_RETRIEVE);
155
         });
155
         });
156
     }
156
     }
157
 }
157
 }

+ 3
- 1
src/utils/WebData.js View File

5
     BAD_CREDENTIALS: 1,
5
     BAD_CREDENTIALS: 1,
6
     BAD_TOKEN: 2,
6
     BAD_TOKEN: 2,
7
     NO_CONSENT: 3,
7
     NO_CONSENT: 3,
8
+    TOKEN_SAVE: 4,
9
+    TOKEN_RETRIEVE: 5,
8
     BAD_INPUT: 400,
10
     BAD_INPUT: 400,
9
     FORBIDDEN: 403,
11
     FORBIDDEN: 403,
10
     CONNECTION_ERROR: 404,
12
     CONNECTION_ERROR: 404,
41
                     else
43
                     else
42
                         reject(response.error);
44
                         reject(response.error);
43
                 } else
45
                 } else
44
-                    reject(ERROR_TYPE.CONNECTION_ERROR);
46
+                    reject(ERROR_TYPE.SERVER_ERROR);
45
             })
47
             })
46
             .catch(() => {
48
             .catch(() => {
47
                 reject(ERROR_TYPE.CONNECTION_ERROR);
49
                 reject(ERROR_TYPE.CONNECTION_ERROR);

+ 1
- 0
translations/en.json View File

259
     "badCredentials": "Email or password invalid.",
259
     "badCredentials": "Email or password invalid.",
260
     "badToken": "You are not logged in. Please login and try again.",
260
     "badToken": "You are not logged in. Please login and try again.",
261
     "noConsent": "You did not give your consent for data processing to the Amicale.",
261
     "noConsent": "You did not give your consent for data processing to the Amicale.",
262
+    "tokenSave": "Could not save session token. Please contact support.",
262
     "badInput": "Invalid input. Please try again.",
263
     "badInput": "Invalid input. Please try again.",
263
     "forbidden": "You do not have access to this data.",
264
     "forbidden": "You do not have access to this data.",
264
     "connectionError": "Network error. Please check your internet connection.",
265
     "connectionError": "Network error. Please check your internet connection.",

+ 1
- 0
translations/fr.json View File

259
     "badCredentials": "Email ou mot de passe invalide.",
259
     "badCredentials": "Email ou mot de passe invalide.",
260
     "badToken": "Vous n'êtes pas connecté. Merci de vous connecter puis réessayez.",
260
     "badToken": "Vous n'êtes pas connecté. Merci de vous connecter puis réessayez.",
261
     "noConsent": "Vous n'avez pas donné votre consentement pour l'utilisation de vos données personnelles.",
261
     "noConsent": "Vous n'avez pas donné votre consentement pour l'utilisation de vos données personnelles.",
262
+    "tokenSave": "Impossible de sauvegarder le token de session. Merci de contacter le support.",
262
     "badInput": "Entrée invalide. Merci de réessayer.",
263
     "badInput": "Entrée invalide. Merci de réessayer.",
263
     "forbidden": "Vous n'avez pas accès à cette information.",
264
     "forbidden": "Vous n'avez pas accès à cette information.",
264
     "connectionError": "Erreur de réseau. Merci de vérifier votre connexion Internet.",
265
     "connectionError": "Erreur de réseau. Merci de vérifier votre connexion Internet.",

Loading…
Cancel
Save