Revize dde3db30
Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)
static/js/certificate.js | ||
---|---|---|
89 | 89 |
this.issuerLoaded = true; |
90 | 90 |
} else { |
91 | 91 |
// certificate does not exists |
92 |
console.error("Required certificate does not exists");
|
|
93 |
this.showError("Error occurred while loading issuer's details.");
|
|
92 |
console.error(response.data["data"]);
|
|
93 |
this.errorMessage = "Error occurred while loading issuer's details.";
|
|
94 | 94 |
} |
95 | 95 |
} catch (error) { |
96 | 96 |
console.error(error); |
97 |
this.showError("Error occurred while loading issuer's details.");
|
|
97 |
this.errorMessage = "Error occurred while loading issuer's details.";
|
|
98 | 98 |
} |
99 | 99 |
} |
100 | 100 |
this.displayIssuer = ~this.displayIssuer; |
101 | 101 |
}, |
102 | 102 |
onCertificateDownload: async function () { |
103 |
await onCertificateDownload(this.id); |
|
103 |
try { |
|
104 |
await onCertificateDownload(this.id); |
|
105 |
} |
|
106 |
catch (err) { |
|
107 |
this.errorMessage = err.message; |
|
108 |
} |
|
104 | 109 |
}, |
105 | 110 |
onRootDownload: async function () { |
106 |
await onCertificateRootDownload(this.id); |
|
111 |
try { |
|
112 |
await onCertificateRootDownload(this.id); |
|
113 |
} |
|
114 |
catch (err) { |
|
115 |
this.errorMessage = err.message; |
|
116 |
} |
|
107 | 117 |
}, |
108 | 118 |
onChainDownload: async function () { |
109 |
await onCertificateChainDownload(this.id); |
|
119 |
try { |
|
120 |
await onCertificateChainDownload(this.id); |
|
121 |
} |
|
122 |
catch (err) { |
|
123 |
this.errorMessage = err.message; |
|
124 |
} |
|
110 | 125 |
}, |
111 | 126 |
onPublicKeyDownload: async function () { |
112 |
await onPublicKeyDownload(this.id); |
|
127 |
try { |
|
128 |
await onPublicKeyDownload(this.id); |
|
129 |
} |
|
130 |
catch (err) { |
|
131 |
this.errorMessage = err.message; |
|
132 |
} |
|
113 | 133 |
}, |
114 | 134 |
onPrivateKeyDownload: async function () { |
115 |
await onPrivateKeyDownload(this.id); |
|
135 |
try { |
|
136 |
await onPrivateKeyDownload(this.id); |
|
137 |
} |
|
138 |
catch (err) { |
|
139 |
this.errorMessage = err.message; |
|
140 |
} |
|
116 | 141 |
}, |
117 | 142 |
onIdentityDownload: async function() { |
118 |
this.errorMessage = ""; |
|
119 |
if (this.identityName === "") { |
|
120 |
this.errorMessage = "Identity name must not be empty! Please try again."; |
|
121 |
document.body.scrollTop = 0; |
|
122 |
document.documentElement.scrollTop = 0; |
|
123 |
return; |
|
124 |
} |
|
125 |
await onIdentityDownload(this.id, this.identityName, this.identityPass); |
|
143 |
try { |
|
144 |
this.errorMessage = ""; |
|
145 |
if (this.identityName === "") { |
|
146 |
this.errorMessage = "Identity name must not be empty! Please try again."; |
|
147 |
document.body.scrollTop = 0; |
|
148 |
document.documentElement.scrollTop = 0; |
|
149 |
return; |
|
150 |
} |
|
151 |
await onIdentityDownload(this.id, this.identityName, this.identityPass); |
|
152 |
} catch (err) { |
|
153 |
this.errorMessage = err.message; |
|
154 |
} |
|
126 | 155 |
}, |
127 | 156 |
onRevoke: async function () { |
128 | 157 |
document.body.scrollTop = 0; |
... | ... | |
136 | 165 |
this.certificate.status="revoked"; |
137 | 166 |
certificateDetailsApp.successMessage = "Certificate revocation successful."; |
138 | 167 |
} else { |
168 |
console.error(response.data["data"]); |
|
139 | 169 |
certificateDetailsApp.errorMessage = "Certificate cannot be revoked - " + response.data["data"] + "!"; |
140 | 170 |
} |
141 | 171 |
} catch (error) { |
172 |
console.error(error); |
|
142 | 173 |
certificateDetailsApp.errorMessage = "An error occurred while revoking certificate"; |
143 | 174 |
} |
144 | 175 |
}, |
... | ... | |
150 | 181 |
if (response.data["success"]) { |
151 | 182 |
window.location.href = "/static/index.html?success=Certificate+successfully+deleted"; |
152 | 183 |
} else { |
184 |
console.error(response.data["data"]); |
|
153 | 185 |
certificateDetailsApp.errorMessage = "Certificate cannot be deleted - " + response.data["data"] + "!"; |
154 | 186 |
} |
155 | 187 |
} catch (error) { |
188 |
console.error(error); |
|
156 | 189 |
certificateDetailsApp.errorMessage = "An error occurred while deleting certificate"; |
157 | 190 |
} |
158 | 191 |
} |
... | ... | |
177 | 210 |
} else { |
178 | 211 |
// certificate does not exists |
179 | 212 |
console.error("Required certificate does not exists"); |
213 |
console.error(response.data["data"]) |
|
180 | 214 |
certificateDetailsApp.loading = false; |
181 | 215 |
certificateDetailsApp.error = true; |
182 | 216 |
} |
... | ... | |
214 | 248 |
certificateDetailsApp.issuedCertificates = []; |
215 | 249 |
} |
216 | 250 |
} catch (error) { |
217 |
console.log(error);
|
|
251 |
console.error(error);
|
|
218 | 252 |
} |
219 | 253 |
this.loading = false; |
220 | 254 |
this.error = false; |
Také k dispozici: Unified diff
Re #8587 - Error handling improved in all javascript files