Skip to content

Commit

Permalink
workaround for #493 (Cont.) (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitingren authored Apr 19, 2023
1 parent 0a4dfb6 commit 26c3707
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from __future__ import print_function, division, absolute_import

import re
import warnings

from struct import unpack

Expand All @@ -57,9 +58,26 @@ def __init__(self, data):
data = unpack('{0}sx'.format(len(data) - 1), data)[0]
try:
self.command_tag = data.decode('utf-8')
except UnicodeDecodeError as e:
except Exception as e:
# (workaround for #493) something wrong in the server, hide the problem for now
self.command_tag = data.decode('utf-8', 'backslashreplace')
warnings.warn("Hit a known server bug\n"
f"{'='*80}\n"
"We'd like to gather client-side information to help with the bug investigation.\n"
"Please leave a comment under https://github.com/vertica/vertica-python/issues/493"
" with the following info:\n"
f"{'-'*80}\n"
f"command tag length: {len(data)}\n"
f"command tag content: {data}\n"
f"{type(e).__name__}: {str(e)}\n"
"Server version: xxx\n"
"Query executed (if possible): xxx\n"
"The OS of each server node (if possible): xxx\n"
"The locale of each server node (if possible): xxx\n"
f"{'-'*80}\n"
f"We appreciate your help!\n"
f"{'='*80}\n"
)
self.command_tag = 'x'

def __str__(self):
return 'CommandComplete: command_tag = "{}"'.format(self.command_tag)
Expand Down

0 comments on commit 26c3707

Please sign in to comment.