Fixed issue #115 - Added more detailed error handling to client-side syn...

...c states
Change sync.state to one of the sync.SYNC_* state constants, depending on what you expect it to be.