Skip to content

Commit

Permalink
Fixed incomplete error message (#24)
Browse files Browse the repository at this point in the history
Fixed incomplete error message in Python2.7 on running `Drop Keyspace` query.
  • Loading branch information
HarshDaryani896 authored Apr 8, 2024
1 parent c118076 commit 5f6ee08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/ycqlsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ def cmdloop(self):
except EOFError:
self.handle_eof()
except CQL_ERRORS as cqlerr:
self.printerr(cqlerr.message)
self.printerr(str(cqlerr))
except KeyboardInterrupt:
self.reset_statement()
print('')
Expand Down Expand Up @@ -1091,7 +1091,7 @@ def perform_simple_statement(self, statement):
try:
result = future.result()
except CQL_ERRORS as err:
err_msg = ensure_text(err.message if hasattr(err, 'message') else str(err))
err_msg = ensure_text(str(err))
self.printerr(str(err.__class__.__name__) + ": " + err_msg)
except Exception:
import traceback
Expand Down
14 changes: 7 additions & 7 deletions pylib/cqlshlib/copyutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def feed():
msg = self.pending_messages.get()
self.pipe.send(msg)
except Exception as e:
printmsg('%s: %s' % (e.__class__.__name__, e.message if hasattr(e, 'message') else str(e)))
printmsg('%s: %s' % (e.__class__.__name__, str(e)))

feeding_thread = threading.Thread(target=feed)
feeding_thread.setDaemon(True)
Expand Down Expand Up @@ -1335,7 +1335,7 @@ def inner_run(self):
try:
reader.start()
except IOError as exc:
self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message if hasattr(exc, 'message') else str(exc)))
self.outmsg.send(ImportTaskError(exc.__class__.__name__, str(exc)))

channels = self.worker_channels
max_pending_chunks = self.max_pending_chunks
Expand Down Expand Up @@ -1364,7 +1364,7 @@ def inner_run(self):
if rows:
sent += self.send_chunk(ch, rows)
except Exception as exc:
self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message if hasattr(exc, 'message') else str(exc)))
self.outmsg.send(ImportTaskError(exc.__class__.__name__, str(exc)))

if reader.exhausted:
break
Expand Down Expand Up @@ -2126,7 +2126,7 @@ def convert(c, v):

if self.debug:
traceback.print_exc()
raise ParseError("Failed to parse %s : %s" % (v, e.message if hasattr(e, 'message') else str(e)))
raise ParseError("Failed to parse %s : %s" % (v, str(e)))

return [convert(conv, val) for conv, val in zip(converters, row)]

Expand Down Expand Up @@ -2494,7 +2494,7 @@ def convert_row(r):
try:
return conv.convert_row(r)
except Exception as err:
errors[err.message if hasattr(err, 'message') else str(err)].append(r)
errors[str(err)].append(r)
return None

converted_rows = [_f for _f in [convert_row(r) for r in rows] if _f]
Expand Down Expand Up @@ -2566,7 +2566,7 @@ def split_into_batches(self, chunk, conv, tm):
pk = get_row_partition_key_values(row)
rows_by_ring_pos[get_ring_pos(ring, pk_to_token_value(pk))].append(row)
except Exception as e:
errors[e.message if hasattr(e, 'message') else str(e)].append(row)
errors[str(e)].append(row)

if errors:
for msg, rows in errors.items():
Expand Down Expand Up @@ -2606,7 +2606,7 @@ def err_callback(self, response, batch, chunk, replicas):
def report_error(self, err, chunk=None, rows=None, attempts=1, final=True):
if self.debug and sys.exc_info()[1] == err:
traceback.print_exc()
err_msg = err.message if hasattr(err, 'message') else str(err)
err_msg = str(err)
self.outmsg.send(ImportTaskError(err.__class__.__name__, err_msg, rows, attempts, final))
if final and chunk is not None:
self.update_chunk(rows, chunk)
Expand Down

0 comments on commit 5f6ee08

Please sign in to comment.