Skip to content

Commit d18544b

Browse files
User defined errors raised by the database no longer display an error
help portal URL.
1 parent 86ca48d commit d18544b

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

doc/src/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Thin Mode Changes
2020
#) Added support for writing UTF-8 encoded bytes to CLOB and NCLOB values and
2121
writing strings to BLOB values in order to be consistent with what is done
2222
for string variables.
23+
#) User defined errors raised by the database no longer display an error help
24+
portal URL.
2325
#) Fixed potential cursor issues when using DRCP.
2426
#) Fixed regression when using IAM token authentication
2527
(`issue 288 <https://github.com/oracle/python-oracledb/issues/288>`__).

src/oracledb/errors.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def _make_adjustments(self):
7575
# add Oracle Database Error Help Portal URL for database error
7676
# messages, but only in thin mode since this is done
7777
# automatically in thick mode with Oracle Client 23c and higher
78-
if self.code != 0 and is_thin_mode():
78+
if (
79+
self.code != 0
80+
and (self.code < 20000 or self.code >= 21000)
81+
and is_thin_mode()
82+
):
7983
self.message = (
8084
self.message
8185
+ "\n"

tests/test_1700_error.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,22 @@ def test_1707(self):
182182
self.assertIsNone(self.cursor.warning)
183183
self.cursor.execute(f"drop procedure {proc_name}")
184184

185+
def test_1708(self):
186+
"1708 - user defined errors do not generate error help portal URL"
187+
for code in (20000, 20500, 20999):
188+
with self.assertRaises(oracledb.Error) as cm:
189+
self.cursor.execute(
190+
f"""
191+
begin
192+
raise_application_error(-{code}, 'User defined error');
193+
end;
194+
"""
195+
)
196+
error_obj = cm.exception.args[0]
197+
self.assertEqual(error_obj.code, code)
198+
self.assertEqual(error_obj.full_code, f"ORA-{code}")
199+
self.assertTrue("Help:" not in error_obj.message)
200+
185201

186202
if __name__ == "__main__":
187203
test_env.run_test_cases()

0 commit comments

Comments
 (0)