Add warning.name to product check security exception (#1515)
This commit is contained in:
committed by
GitHub
parent
77bf94a500
commit
f161946984
@ -559,7 +559,10 @@ class Transport {
|
||||
debug('Product check failed', err)
|
||||
if (err.statusCode === 401 || err.statusCode === 403) {
|
||||
this[kProductCheck] = 2
|
||||
process.emitWarning('The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.')
|
||||
process.emitWarning(
|
||||
'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.',
|
||||
'ProductNotSupportedSecurityError'
|
||||
)
|
||||
productCheckEmitter.emit('product-check', null, true)
|
||||
} else {
|
||||
this[kProductCheck] = 0
|
||||
|
||||
@ -470,7 +470,7 @@ test('Errors v6', t => {
|
||||
})
|
||||
|
||||
test('Auth error - 401', t => {
|
||||
t.plan(8)
|
||||
t.plan(9)
|
||||
const MockConnection = buildMockConnection({
|
||||
onRequest (params) {
|
||||
return {
|
||||
@ -487,6 +487,7 @@ test('Auth error - 401', t => {
|
||||
|
||||
process.on('warning', onWarning)
|
||||
function onWarning (warning) {
|
||||
t.equal(warning.name, 'ProductNotSupportedSecurityError')
|
||||
t.equal(warning.message, 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.')
|
||||
}
|
||||
|
||||
@ -524,7 +525,7 @@ test('Auth error - 401', t => {
|
||||
})
|
||||
|
||||
test('Auth error - 403', t => {
|
||||
t.plan(8)
|
||||
t.plan(9)
|
||||
const MockConnection = buildMockConnection({
|
||||
onRequest (params) {
|
||||
return {
|
||||
@ -541,6 +542,7 @@ test('Auth error - 403', t => {
|
||||
|
||||
process.on('warning', onWarning)
|
||||
function onWarning (warning) {
|
||||
t.equal(warning.name, 'ProductNotSupportedSecurityError')
|
||||
t.equal(warning.message, 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user