From b9be16c03b9f09f3b6fa62ac17f8b23cc1b7f41c Mon Sep 17 00:00:00 2001 From: Ben Irvin Date: Mon, 31 Oct 2022 10:21:23 +0100 Subject: [PATCH] make errors more specific --- packages/core/data-transfer/lib/engine/index.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/core/data-transfer/lib/engine/index.ts b/packages/core/data-transfer/lib/engine/index.ts index 3ef4a3e0e2..a0a14daa7d 100644 --- a/packages/core/data-transfer/lib/engine/index.ts +++ b/packages/core/data-transfer/lib/engine/index.ts @@ -132,8 +132,11 @@ class TransferEngine implements ITransferEngine { const inStream = await this.sourceProvider.streamEntities?.(); const outStream = await this.destinationProvider.getEntitiesStream?.(); - if (!inStream || !outStream) { - throw new Error('Unable to transfer entities, one of the stream is missing'); + if (!inStream) { + throw new Error('Unable to transfer entities, source stream is missing'); + } + if (!outStream) { + throw new Error('Unable to transfer entities, destination stream is missing'); } return new Promise((resolve, reject) => { @@ -159,8 +162,11 @@ class TransferEngine implements ITransferEngine { const inStream = await this.sourceProvider.streamLinks?.(); const outStream = await this.destinationProvider.getLinksStream?.(); - if (!inStream || !outStream) { - throw new Error('Unable to transfer links, one of the stream is missing'); + if (!inStream) { + throw new Error('Unable to transfer links, source stream is missing'); + } + if (!outStream) { + throw new Error('Unable to transfer links, destination stream is missing'); } return new Promise((resolve, reject) => {