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