def CheckErrorLoggable(self, token):
     """Verify that the error strings we log are valid, loggable strings."""
     try:
         users_id_token._verify_signed_jwt_with_certs(
             token, self._SAMPLE_TIME_NOW, self.cache)
         self.fail('Expected exception.')
     except users_id_token._AppIdentityError, e:
         # Make sure this works without an exception.
         try:
             str(e).decode('utf-8')
         except UnicodeDecodeError:
             printable = ''.join(c if c in string.printable else '\\x%02x' %
                                 ord(c) for c in str(e))
             self.fail('Unsafe error sent to log: %s' % printable)
 def CheckErrorLoggable(self, token):
   """Verify that the error strings we log are valid, loggable strings."""
   try:
     users_id_token._verify_signed_jwt_with_certs(
         token, self._SAMPLE_TIME_NOW, self.cache)
     self.fail('Expected exception.')
   except users_id_token._AppIdentityError, e:
     # Make sure this works without an exception.
     try:
       str(e).decode('utf-8')
     except UnicodeDecodeError:
       printable = ''.join(c if c in string.printable
                           else '\\x%02x' % ord(c)
                           for c in str(e))
       self.fail('Unsafe error sent to log: %s' % printable)