diff --git a/lib/index.js b/lib/index.js index 95b9a27..1c3c40c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -114,7 +114,6 @@ function parseJoinCommand(pieces, uri) { function parseFollowCommand(pieces, uri) { const [label, id] = pieces if (!id) { - // prettier-ignore throw new Error(`Invalid URI "${uri}" for invite.parse, missing follow id`) } pieces.shift() @@ -213,14 +212,12 @@ function parsePromiseAccountAddCommand(pieces, uri) { function parse(uri) { const url = new URL(uri) if (url.protocol !== 'ppppp:') { - throw new Error( - `Invalid protocol in URI "${uri}" for invite.parse, expected "ppppp:"` - ) + // prettier-ignore + throw new Error(`Invalid protocol in URI "${uri}" for invite.parse, expected "ppppp:"`) } if (url.host !== 'invite') { - throw new Error( - `Invalid host in URI "${uri}" for invite.parse, expected "invite"` - ) + // prettier-ignore + throw new Error(`Invalid host in URI "${uri}" for invite.parse, expected "invite"`) } const pieces = url.pathname.startsWith('/') ? url.pathname.substring(1).split('/') @@ -291,6 +288,8 @@ async function makeJoinCommands(peer, amountHubs, hardcodedHub) { : await p(peer.hubClient.getHubs)(amountHubs) // prettier-ignore if (err1) return [new Error('Failed to get hubs while creating invite', { cause: err1 })] + // prettier-ignore + if (hubMultiaddrs.length === 0) return [new Error('No hubs available while creating invite')] // For each hub, connect and create token const hubErrors = []