import { alert } from './dialog';
const dialog_handles = {};
var _handle = function (e) {
    var err = Error.new(e);
    var errno = err.errno;
    if (errno) {
        if (!dialog_handles[errno]) {
            var dag = alert(err.message || 'An unknown exception', () => {
                delete dialog_handles[errno];
            });
            dialog_handles[errno] = dag;
        }
    }
    else {
        alert(err.message || 'An unknown exception');
    }
};
export default function (e) {
    _handle(e);
}
export function setErrorHandle(handle) {
    _handle = handle;
}
