Revert "Remove error handling"

This reverts commit 03c6b6750c82f45c7b2932c25c75ea8c6baa2280.
Correct error handling for all cases

1) Bad JSON encoding: can't do anything, just return.
2) Can't connect: wait a bit and try again.
3) TSDB returns an error: we've got bad data, log it, but don't retry the
data.
Limit simultaneous connections to TSDB server to 1