Move handle errors code in file 'src/core/handleErrors'