implemented correct error messages for login and registration. Added error_code for internal protocol errors to handle errors rather than just pass a message describing the error