Updated abort behavior (#1141)

* Updated abort behavior

- Support for aborting a request with the promise api
- Aborting a request will cause a RequestAbortedError
- Normalized Connection class errors, now every error returned is
wrapped by the client errors constructors

* Updated test

* Updated docs

* Updated code generation script

* Renamed test

* Code coverage

* Avoid calling twice transport.request
This commit is contained in:
Tomas Della Vedova
2020-04-06 11:21:19 +02:00
committed by GitHub
parent 953a8033ab
commit 27a8e2a9bf
16 changed files with 824 additions and 648 deletions

View File

@ -210,7 +210,7 @@ test('Sniff on connection fault', t => {
class MyConnection extends Connection {
request (params, callback) {
if (this.id === 'http://localhost:9200/') {
callback(new Error('kaboom'), null)
callback(new errors.ConnectionError('kaboom'), null)
return {}
} else {
return super.request(params, callback)