Simple way to display IMAP errors:

* raise a specific exception in the imap connector,
 * Add a simple middleware to catch this exception and return a specific response that will be correctly displayed by the webmail.

see #127
This commit is contained in:
Antoine Nguyen
2011-03-28 17:12:12 +02:00
parent 2535bca0fc
commit 53f1cb5899
7 changed files with 68 additions and 28 deletions
+10 -6
View File
@@ -49,15 +49,19 @@ function ajax_submit(event) {
new Request({
method: form.get("method"),
data: data,
onSuccess: function(responseText) {
onSuccess: function(responseText){
var response = JSON.decode(responseText);
if (response.status == "ko") {
$(document.body).set("html", response.content);
$(document.body).addEvent("submit", ajax_submit);
if ($defined(error_callbacks[myid])) {
error_callbacks[myid]();
}
if ($defined(response.norefresh) && response.norefresh == true) {
$("error").set("html", response.error);
} else {
$(document.body).set("html", response.content);
$(document.body).addEvent("submit", ajax_submit);
if ($defined(error_callbacks[myid])) {
error_callbacks[myid]();
}
}
} else {
if ($defined(response.ajaxnav)) {
if ($defined(response.url)) {