-
Notifications
You must be signed in to change notification settings - Fork 726
Closed
Description
🚀 Feature Proposal
To refactor ResponseError.toString
method format to include root_cause
details provided by Elasticsearch server.
Motivation
Applications often log a caught exceptions without additional effort for serialization.
If you log ResponseError
try {
await client.search(...);
} catch (e) {
console.error(e)
}
you don't get an original error_cause
:
ResponseError: illegal_argument_exception
at onBody (.../node_modules/@elastic/elasticsearch/lib/Transport.js:337:23)
at IncomingMessage.onEnd (.../node_modules/@elastic/elasticsearch/lib/Transport.js:264:11)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
meta: {
body: { error: [Object], status: 400 },
statusCode: 400,
headers: {
'content-type': 'application/json;charset=utf-8',
'content-length': '367'
},
meta: {
context: null,
request: [Object],
name: 'elasticsearch-js',
connection: [Object],
attempts: 0,
aborted: false
}
}
}
that makes debugging quite painful.
To makeerror.message
actionalbe, it should include the root_cause
provided by Elasticsearch server: ResponseError: [illegal_argument_exception]. caused by [{ type: "...", reason: "..." }]
pgayvallet
Metadata
Metadata
Assignees
Labels
No labels