Map an ORA error to an NJS error

This commit is contained in:
Christopher Jones 2023-02-21 14:50:24 +11:00
parent 73dbe973e1
commit 91502283c8
2 changed files with 7 additions and 2 deletions

View File

@ -105,6 +105,7 @@ const ERR_INIT_ORACLE_CLIENT_ARGS = 90;
const ERR_MISSING_FILE = 91;
const ERR_INVALID_NUMBER_OF_CONNECTIONS = 92;
const ERR_EXEC_MODE_ONLY_FOR_DML = 95;
const ERR_INVALID_BIND_NAME = 97;
const ERR_POOL_HAS_BUSY_CONNECTIONS = 104;
const ERR_NAN_VALUE = 105;
@ -113,6 +114,7 @@ const adjustErrorXref = new Map();
adjustErrorXref.set("DPI-1063", ERR_EXEC_MODE_ONLY_FOR_DML);
adjustErrorXref.set("ORA-24422", ERR_POOL_HAS_BUSY_CONNECTIONS);
adjustErrorXref.set("DPI-1055", ERR_NAN_VALUE);
adjustErrorXref.set("ORA-01036", ERR_INVALID_BIND_NAME);
// define mapping for error messages
const messages = new Map();
@ -267,6 +269,8 @@ messages.set(ERR_INIT_ORACLE_CLIENT_ARGS,
'initOracleClient() was already called with different arguments!');
messages.set(ERR_MISSING_FILE,
'file %s is missing');
messages.set(ERR_INVALID_BIND_NAME,
'no bind placeholder named: :%s was found in the SQL text');
messages.set(ERR_INVALID_NUMBER_OF_CONNECTIONS,
'poolMax [%d] must be greater than or equal to poolMin [%d]');
messages.set(ERR_EXEC_MODE_ONLY_FOR_DML,
@ -533,6 +537,7 @@ module.exports = {
ERR_EXEC_MODE_ONLY_FOR_DML,
ERR_POOL_HAS_BUSY_CONNECTIONS,
ERR_NAN_VALUE,
ERR_INVALID_BIND_NAME,
assert,
assertArgCount,
assertParamPropBool,

View File

@ -149,8 +149,8 @@ describe('63. autoCommit4nestedExecutes.js', function() {
{ autoCommit: false });
} catch (err) {
assert(err);
// ORA-01036: illegal variable name/number
assert.equal(err.message.substring(0, 10), `ORA-01036:`);
// NJS-097: illegal variable name/number
assert.equal(err.message.substring(0, err.message.indexOf(':')), `NJS-097`);
}
await conn.release();