Crawler: error handling added

Added: error logging on exception
Replaced: perror with exceptions
Removed: unnecessary includes
Creating and sending document in a new function