Improved user-menu-logic.js file with more powerfull error handler