Move pool size error to NJS prefixed message
This commit is contained in:
parent
5a8317ac04
commit
93dcfb58fe
|
@ -103,6 +103,7 @@ const ERR_TOKEN_CALLBACK_DUP = 88;
|
|||
const ERR_NOT_IMPLEMENTED = 89;
|
||||
const ERR_INIT_ORACLE_CLIENT_ARGS = 90;
|
||||
const ERR_MISSING_FILE = 91;
|
||||
const ERR_INVALID_NUMBER_OF_CONNECTIONS = 92;
|
||||
|
||||
const messages = new Map();
|
||||
messages.set(ERR_INVALID_CONNECTION,
|
||||
|
@ -256,6 +257,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_NUMBER_OF_CONNECTIONS,
|
||||
'poolMax [%d] must be greater than or equal to poolMin [%d]');
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// assert()
|
||||
|
@ -487,6 +490,7 @@ module.exports = {
|
|||
ERR_NOT_IMPLEMENTED,
|
||||
ERR_INIT_ORACLE_CLIENT_ARGS,
|
||||
ERR_MISSING_FILE,
|
||||
ERR_INVALID_NUMBER_OF_CONNECTIONS,
|
||||
assert,
|
||||
assertArgCount,
|
||||
assertParamPropBool,
|
||||
|
|
|
@ -185,10 +185,10 @@ async function _verifyOptions(options, inCreatePool) {
|
|||
// check pool specific options
|
||||
if (inCreatePool) {
|
||||
|
||||
// poolMax must be an integer >= 0
|
||||
// poolMax must be an integer > 0
|
||||
if (options.poolMax !== undefined) {
|
||||
errors.assertParamPropValue(Number.isInteger(options.poolMax) &&
|
||||
options.poolMax >= 0, 1, "poolMax");
|
||||
options.poolMax > 0, 1, "poolMax");
|
||||
outOptions.poolMax = options.poolMax;
|
||||
}
|
||||
|
||||
|
@ -402,6 +402,12 @@ async function createPool(options) {
|
|||
"queueMax",
|
||||
"queueTimeout");
|
||||
|
||||
// poolMax must be greater than or equal to poolMin
|
||||
if (options.poolMin > options.poolMax) {
|
||||
errors.throwErr(errors.ERR_INVALID_NUMBER_OF_CONNECTIONS, options.poolMax,
|
||||
options.poolMin);
|
||||
}
|
||||
|
||||
// initialize the Oracle client, if necessary
|
||||
if (_initOracleClientArgs === undefined) {
|
||||
initOracleClient();
|
||||
|
|
|
@ -138,7 +138,7 @@ describe('2. pool.js', function() {
|
|||
},
|
||||
function(err, pool) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('ORA-24413:');
|
||||
(err.message).should.startWith('NJS-092:');
|
||||
|
||||
should.not.exist(pool);
|
||||
done();
|
||||
|
@ -213,7 +213,7 @@ describe('2. pool.js', function() {
|
|||
},
|
||||
function(err, pool) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('ORA-24413:');
|
||||
(err.message).should.startWith('NJS-007:');
|
||||
|
||||
should.not.exist(pool);
|
||||
done();
|
||||
|
@ -1046,8 +1046,7 @@ describe('2. pool.js', function() {
|
|||
},
|
||||
function(err, pool) {
|
||||
should.exist(err);
|
||||
(err.message).should.startWith('ORA-24413: ');
|
||||
// ORA-24413: Invalid number of sessions specified
|
||||
(err.message).should.startWith('NJS-092:');
|
||||
should.not.exist(pool);
|
||||
done();
|
||||
}
|
||||
|
|
|
@ -1178,7 +1178,7 @@ describe('255. poolReconfigure.js', function() {
|
|||
try {
|
||||
await pool.reconfigure({poolMax: 0});
|
||||
} catch (err) {
|
||||
(err.message).startsWith ('ORA-24413');
|
||||
(err.message).startsWith ('NJS-007');
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue