Prevent to suppress error in async routable modals

How to do it? Errors inside the call resolve are suppressed or something I do not understand?
Thanks for the answer!

What kind of errors?

Errors while executing. Maybe missing properties, bad index of array ets.

1 Like

Post example sintaxe?

/* 
    Add route for dynamic contact popup
*/
// get last 404 route 
var lastroute = app.routes.pop();
// add contact route
var _lock = false; // for prevent double-tap
app.routes.push({
    path: '/contact/:contactid/',
    async: function(routeTo, routeFrom, resolve, reject) {
        if (_lock) return;
        _lock = true;
        var contactid = routeTo.params.contactid;
        ContactsManager.loadContact(contactid, function(contact) {
            resolve({
                popup: {
                    templateUrl: './pages/popup-contact.html'
                }
            }, {
                context: {
                    contact: contact
                }
            });
        });
        setTimeout(function() {
            _lock = false;
        }, 350);
    }
});
// return last 404 route
app.routes.push(lastroute);

The dynamic route for my contact popup.

    app.on('modalInit', function(modalEl, modalRoute, modal) {
    if (modal.$el.hasClass('popup-contact')) {
        modalInstance = modal;
        contact = modalRoute.context.contact;
        displayContactUI();
    }
});

All errors in here modalInit callback not fired in window.onerror global event. I use a global event to intercept all errors and send logs.

Still not very clear, would be good to see live example or JSFiddle of usecase