Projekt

Obecné

Profil

« Předchozí | Další » 

Revize dde3db30

Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)

Re #8587 - Error handling improved in all javascript files

Zobrazit rozdíly:

static/js/create_certificate.js
66 66
            if (response.data["success"]) {
67 67
                createCertificateApp.authorities = response.data["data"];
68 68
            } else {
69
                createCertificateApp.authorities = []
69
                this.showError("Error occurred while downloading list of available CAs");
70
                console.error(response.data["data"]);
71
                createCertificateApp.authorities = [];
70 72
            }
71 73
        } catch (error) {
74
            this.showError("Error occurred while downloading list of available CAs");
72 75
            console.log(error);
73 76
        }
74 77
    },
......
93 96
        // handle certificate creation request
94 97
        onCreateCertificate: async function () {
95 98
            // validate input data
99
            // - validate if is self signed or CA is selected
96 100
            // - validate if subject CN is filled in
101
            // - validate if C is either empty or has exactly 2 characters
97 102
            if (!this.isSelfSigned && this.certificateData.CA == null) {
98 103
                this.showError("Issuer must be selected or 'Self-signed' option must be checked!")
99 104
                return;
......
142 147
                }
143 148
                // on error display server response message
144 149
                else {
150
                    console.error(response.data["data"]);
145 151
                    createCertificateApp.showError(response.data["data"]);
146 152
                }
147 153
            } catch (error) {
148
                createCertificateApp.showError(error.response.data["data"]);
154
                createCertificateApp.showError("An error occurred while creating a certificate.");
149 155
                console.error(error);
150 156
            }
151 157
        }

Také k dispozici: Unified diff