success: function () {
save_map_success(rspamd);
},
- error: function (serv, jqXHR, textStatus, errorThrown) {
- save_map_error(rspamd, serv, jqXHR, textStatus, errorThrown);
- },
+ errorMessage: "Save map error",
method: "POST",
headers: {
Map: id,
ui.getHistory(rspamd, tables, neighbours, checked_server);
ui.getErrors(rspamd, tables, neighbours, checked_server);
},
- error: function (serv, jqXHR, textStatus, errorThrown) {
- var serv_name = (typeof serv === "string") ? serv : serv.name;
- rspamd.alertMessage("alert-error",
- "Cannot reset history log on " + serv_name + ": " + errorThrown);
- }
+ errorMessage: "Cannot reset history log"
});
});
};
beforeSend: function (xhr) {
xhr.setRequestHeader("Password", rspamd.getPassword());
},
- error: function () {
- rspamd.alertMessage("alert-error", "Cannot receive errors");
- },
success: function (data) {
drawErrorsTable(data);
- }
+ },
+ errorMessage: "Cannot receive errors"
});
} else {
rspamd.query("errors", {
o.error(neighbours_status[ind],
jqXHR, textStatus, errorThrown);
} else {
- alertMessage("alert-error", "Cannot receive data from " +
- neighbours_status[ind].host + ": " + errorThrown);
+ alertMessage("alert-error", neighbours_status[ind].name + " > " +
+ ((o.errorMessage) ? o.errorMessage : "Request failed") + ": " + errorThrown);
}
},
complete: function () {
*
* @param {Object|string|Array} [options.data] - Data to be sent to the server.
* @param {Function} [options.error] - A function to be called if the request fails.
+ * @param {string} [options.errorMessage] - Text to display in the alert message if the request fails.
* @param {Object} [options.headers] - An object of additional header key/value pairs to send along with requests
* using the XMLHttpRequest transport.
* @param {string} [options.method] - The HTTP method to use for the request.
// Force options to be an object
var o = options || {};
Object.keys(o).forEach(function (option) {
- if (["data", "error", "headers", "method", "params", "server", "success"].indexOf(option) < 0) {
+ if (["data", "error", "errorMessage", "headers", "method", "params", "server", "success"].indexOf(option) < 0) {
throw new Error("Unknown option: " + option);
}
});
success: function () {
rspamd.alertMessage("alert-modal alert-success", "Symbols successfully saved");
},
- error: function (serv, jqXHR, textStatus, errorThrown) {
- var serv_name = (typeof serv === "string") ? serv : serv.name;
- rspamd.alertMessage("alert-modal alert-error",
- "Save symbols error on " + serv_name + ": " + errorThrown);
- },
+ errorMessage: "Save symbols error",
method: "POST",
params: {
data: JSON.stringify(values),
}
});
},
- error: function (data) {
- rspamd.alertMessage("alert-modal alert-error", data.statusText);
- },
server: (checked_server === "All SERVERS") ? "local" : checked_server
});
$("#symbolsTable")
var items = process_symbols_data(data[0].data)[0];
ft.symbols.rows.load(items);
},
- error: function (data) {
- rspamd.alertMessage("alert-modal alert-error", data.statusText);
- },
server: (checked_server === "All SERVERS") ? "local" : checked_server
});
});
rspamd.alertMessage("alert-error", "Cannot scan data");
}
},
- error: function (jqXHR, textStatus, errorThrown) {
- rspamd.alertMessage("alert-error", "Cannot upload data: " +
- textStatus + ", " + errorThrown);
- },
+ errorMessage: "Cannot upload data",
statusCode: {
404: function () {
rspamd.alertMessage("alert-error", "Cannot upload data, no server found");