Register a JSON handler to show error responses as error message instead of losing them.

This commit is contained in:
Nathan Gray 2014-02-13 18:47:19 +00:00
parent 551dff28e3
commit bad65780bc

View File

@ -29,6 +29,16 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
var error_reg_exp;
var on_click_remove_installed = false;
// Register an 'error' plugin, displaying using the message system
this.registerJSONPlugin(function(type, res, req) {
if (typeof res.data == 'string')
{
egw.message(res.data,'error');
return true;
}
throw 'Invalid parameters';
}, null, 'error');
return {
/**
* Display an error or regular message