-
Notifications
You must be signed in to change notification settings - Fork 725
Closed
Labels
Description
Currently, the SerializationError and DeserializationError make easy to understand what went wrong, but not why.
The bad object/string is not part of the error, which makes more complex the debugging experience.
This can be easily improved by adding a data field to both the error classes:
class DeserializationError extends ElasticsearchClientError {
- constructor (message) {
+ constructor (message, data) {
super(message)
Error.captureStackTrace(this, DeserializationError)
this.name = 'DeserializationError'
this.message = message || 'Deserialization Error'
+ this.data = data
}
}Then the code should be updated accordingly in lib/Serialize.js and in lib/errors.d.ts.
Related: #1088