Compare commits
1 Commits
integratio
...
better-err
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dc4857747 |
@@ -5,6 +5,7 @@
|
||||
|
||||
const crypto = require('crypto')
|
||||
const PriorityQueue = require('priorityqueuejs')
|
||||
const { Inaccessible } = require('../base-service/errors')
|
||||
|
||||
/**
|
||||
* Compute a one-way hash of the input string.
|
||||
@@ -265,7 +266,10 @@ class TokenPool {
|
||||
}
|
||||
}
|
||||
|
||||
throw Error('Token pool is exhausted')
|
||||
throw new Inaccessible({
|
||||
underlyingError: Error('Token pool is exhausted'),
|
||||
prettyMessage: 'no tokens available',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
const { expect } = require('chai')
|
||||
const sinon = require('sinon')
|
||||
const times = require('lodash.times')
|
||||
const { Inaccessible } = require('../base-service/errors')
|
||||
const { Token, TokenPool } = require('./token-pool')
|
||||
|
||||
function expectPoolToBeExhausted(pool) {
|
||||
expect(() => {
|
||||
pool.next()
|
||||
}).to.throw(Error, /^Token pool is exhausted$/)
|
||||
}).to.throw(Inaccessible, /^Inaccessible: Token pool is exhausted$/)
|
||||
}
|
||||
|
||||
describe('The token pool', function() {
|
||||
|
||||
Reference in New Issue
Block a user