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

...c states
Use the named constants instead of numbers, so this is easier to read and understand what's happening.