Skip to content

Commit

Permalink
Avoid raising an exception if an error message is not correctly UTF-8
Browse files Browse the repository at this point in the history
encoded.
  • Loading branch information
anthony-tuininga committed Jul 19, 2024
1 parent a95def8 commit 023092c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Thick Mode Changes

#) Eliminated memory leak when dequeing messages with JSON payloads
(`issue 346 <https://github.com/oracle/python-oracledb/issues/346>`__).
#) An exception is now avoided if an error message is not correctly UTF-8
encoded by the database.

Common Changes
++++++++++++++
Expand Down
4 changes: 2 additions & 2 deletions src/oracledb/impl/thick/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ cdef object _create_new_from_info(dpiErrorInfo *error_info):
"""
cdef bytes msg_bytes = error_info.message[:error_info.messageLength]
context = "%s: %s" % (error_info.fnName, error_info.action)
return errors._Error(msg_bytes.decode(), context, code=error_info.code,
offset=error_info.offset,
return errors._Error(msg_bytes.decode("utf-8", "replace"), context,
code=error_info.code, offset=error_info.offset,
isrecoverable=error_info.isRecoverable,
iswarning=error_info.isWarning)

Expand Down

0 comments on commit 023092c

Please sign in to comment.