From c4931512d47fcb79ca382c08a1c33b15607e0225 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 18 Dec 2017 17:57:31 -0800 Subject: [PATCH] added check for empty channel urls --- helpers/lbryUri.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helpers/lbryUri.js b/helpers/lbryUri.js index cc5e1d9e..15ab0b86 100644 --- a/helpers/lbryUri.js +++ b/helpers/lbryUri.js @@ -17,6 +17,9 @@ module.exports = { logger.debug(`${proto}, ${value}, ${modifierSeperator}, ${modifier}`); // Validate and process name + if (!value) { + throw new Error(`Check your url. No channel name provided before "${modifierSeperator}"`); + } const isChannel = value.startsWith(module.exports.CHANNEL_CHAR); const channelName = isChannel ? value : null; let claimId; @@ -36,13 +39,13 @@ module.exports = { let channelClaimId; if (modifierSeperator) { if (!modifier) { - throw new Error(`No modifier provided after separator ${modifierSeperator}.`); + throw new Error(`No modifier provided after separator "${modifierSeperator}"`); } if (modifierSeperator === ':') { channelClaimId = modifier; } else { - throw new Error(`The ${modifierSeperator} modifier is not currently supported.`); + throw new Error(`The "${modifierSeperator}" modifier is not currently supported`); } } return {