Improve catching of errors

Ensure that if there is a problem with a single dataset, that the whole
publisher doesn't stop.

Also reset urls_string at the start of each file, instead of the end, so
that errors don't result in files assigned to the wrong publisher.
Split out validation routines for easier testing