Sort of working error handling.

Seems to stick with the first error though - sync on 501?