refactor: don't build virtualRecyclers in case of error
This commit is contained in:
parent
3accb2b54e
commit
f2d07c8cc7
1 changed files with 3 additions and 4 deletions
|
|
@ -207,11 +207,8 @@ function plugins (settings, deviceId) {
|
||||||
_.range(1, numberOfRecyclers+1)
|
_.range(1, numberOfRecyclers+1)
|
||||||
)
|
)
|
||||||
|
|
||||||
const virtualRecyclers = denominations.length ? [Math.max(..._.flatten(denominations)) * 2] : []
|
if (counts.length !== denominations.length)
|
||||||
|
|
||||||
if (counts.length !== denominations.length) {
|
|
||||||
throw new Error('Denominations and respective counts do not match!')
|
throw new Error('Denominations and respective counts do not match!')
|
||||||
}
|
|
||||||
|
|
||||||
const recyclers = _.map(
|
const recyclers = _.map(
|
||||||
it => ({
|
it => ({
|
||||||
|
|
@ -223,6 +220,8 @@ function plugins (settings, deviceId) {
|
||||||
_.range(0, numberOfRecyclers)
|
_.range(0, numberOfRecyclers)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const virtualRecyclers = denominations.length ? [Math.max(..._.flatten(denominations)) * 2] : []
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return {
|
return {
|
||||||
recyclers: computeAvailableRecyclers(recyclers, redeemableTxs),
|
recyclers: computeAvailableRecyclers(recyclers, redeemableTxs),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue