File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ Thin Mode Changes
2929#) Added support for growing the pool back to the minimum number of
3030 connections allowed in the pool when connections are killed or otherwise
3131 made unusable.
32+ #) Added URL to the Oracle Database Error Help Portal in Oracle Database
33+ error messages similar to when Thick mode uses Oracle Client 23c.
3234#) A default connection class is now generated when DRCP is used with a
3335 connection pool and no connection class was specified when the pool was
3436 created. The default connection class will be of the form ``DPY: `` followed
Original file line number Diff line number Diff line change 3333
3434import re
3535
36+ from .driver_mode import is_thin_mode
3637from . import exceptions
3738
3839class _Error :
@@ -62,6 +63,14 @@ def _make_adjustments(self):
6263 pos = self .message .find (":" )
6364 if pos > 0 :
6465 self .full_code = self .message [:pos ]
66+
67+ # add Oracle Database Error Help Portal URL for database error
68+ # messages, but only in thin mode since this is done
69+ # automatically in thick mode with Oracle Client 23c and higher
70+ if self .code != 0 and is_thin_mode ():
71+ self .message = self .message + "\n " + \
72+ "Help: https://docs.oracle.com/error-help/db/ora-" + \
73+ f"{ self .code :05} /"
6574 if self .code != 0 or self .full_code .startswith ("DPI-" ):
6675 args = {}
6776 if self .code != 0 :
Original file line number Diff line number Diff line change 2727"""
2828
2929import pickle
30+ import unittest
3031
3132import oracledb
3233import test_env
@@ -83,5 +84,16 @@ def test_1702_error_full_code(self):
8384 error_obj , = cm .exception .args
8485 self .assertEqual (error_obj .full_code , "DPI-1037" )
8586
87+ @unittest .skipIf (test_env .get_client_version () < (23 , 1 ),
88+ "unsupported client" )
89+ def test_1703_error_help_url (self ):
90+ "1703 - test generation of error help portal URL"
91+ cursor = self .connection .cursor ()
92+ with self .assertRaises (oracledb .Error ) as cm :
93+ cursor .execute ("select 1 / 0 from dual" )
94+ error_obj , = cm .exception .args
95+ to_check = "Help: https://docs.oracle.com/error-help/db/ora-01476/"
96+ self .assertIn (to_check , error_obj .message )
97+
8698if __name__ == "__main__" :
8799 test_env .run_test_cases ()
You can’t perform that action at this time.
0 commit comments