diff --git a/src/dial-test.js b/src/dial-test.js index 35d383b..11b9dea 100644 --- a/src/dial-test.js +++ b/src/dial-test.js @@ -62,6 +62,7 @@ module.exports = (common) => { await socket } catch (err) { expect(err.code).to.eql(AbortError.code) + expect(err.type).to.eql(AbortError.type) return } expect.fail('Did not throw error with code ' + AbortError.code) @@ -80,6 +81,7 @@ module.exports = (common) => { await socket } catch (err) { expect(err.code).to.eql(AbortError.code) + expect(err.type).to.eql(AbortError.type) return } finally { connector.restore() diff --git a/src/errors.js b/src/errors.js index 32289a5..40dd027 100644 --- a/src/errors.js +++ b/src/errors.js @@ -4,11 +4,16 @@ class AbortError extends Error { constructor () { super('AbortError') this.code = AbortError.code + this.type = AbortError.type } static get code () { return 'ABORT_ERR' } + + static get type () { + return 'aborted' + } } module.exports = {