detect request errors in nodejs