chore: add error codes (#155)

* chore: add error codes

* chore: create errors with new Error()

* fix: better error testin

* refactor: simplify random bytes error checks
This commit is contained in:
dirkmc
2019-07-22 06:16:02 -04:00
committed by Jacob Heun
parent 2d15e717e4
commit 0b686d363c
23 changed files with 172 additions and 72 deletions

16
test/util/index.js Normal file
View File

@ -0,0 +1,16 @@
'use strict'
const chai = require('chai')
const expect = chai.expect
const expectErrCode = async (p, code) => {
try {
await p
} catch (err) {
expect(err).to.have.property('code', code)
return
}
expect.fail(`Expected error with code ${code} but no error thrown`)
}
module.exports = { expectErrCode }