1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-14 05:05:10 -05:00
mail/src/js/util/error.js
2013-11-14 23:57:06 +01:00

27 lines
608 B
JavaScript

define(function() {
'use strict';
var er = {};
er.attachHandler = function(scope) {
scope.$root.onError = function(options) {
if (!options) {
return;
}
console.error(options);
scope.state.dialog = {
open: true,
title: options.title || 'Error',
message: options.errMsg || options.message
};
// don't call apply for synchronous calls
if (!options.sync) {
scope.$apply();
}
};
};
return er;
});