From 283572d7e36d4ea4c80c8c12265bf922dc939006 Mon Sep 17 00:00:00 2001 From: tabcat Date: Mon, 9 May 2022 22:42:04 -0500 Subject: [PATCH] improve manifest fetch timeout error msg --- src/OrbitDB.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/OrbitDB.js b/src/OrbitDB.js index 9f617e2..8dc001a 100644 --- a/src/OrbitDB.js +++ b/src/OrbitDB.js @@ -448,9 +448,19 @@ class OrbitDB { logger.debug(`Loading Manifest for '${dbAddress}'`) - // Get the database manifest from IPFS - const manifest = await io.read(this._ipfs, dbAddress.root, { timeout: options.timeout || defaultTimeout }) - logger.debug(`Manifest for '${dbAddress}':\n${JSON.stringify(manifest, null, 2)}`) + let manifest + try { + // Get the database manifest from IPFS + manifest = await io.read(this._ipfs, dbAddress.root, { timeout: options.timeout || defaultTimeout }) + logger.debug(`Manifest for '${dbAddress}':\n${JSON.stringify(manifest, null, 2)}`) + } catch (e) { + if (e.name === 'TimeoutError' && e.code === 'ERR_TIMEOUT') { + console.error(e) + throw new Error('ipfs unable to find and fetch manifest for this address.') + } else { + throw e + } + } if (manifest.name !== dbAddress.path) { logger.warn(`Manifest name '${manifest.name}' and path name '${dbAddress.path}' do not match`)