Error handling on index.js