added check for empty channel urls #310
1 changed files with 5 additions and 2 deletions
|
@ -17,6 +17,9 @@ module.exports = {
|
||||||
logger.debug(`${proto}, ${value}, ${modifierSeperator}, ${modifier}`);
|
logger.debug(`${proto}, ${value}, ${modifierSeperator}, ${modifier}`);
|
||||||
|
|
||||||
// Validate and process name
|
// 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 isChannel = value.startsWith(module.exports.CHANNEL_CHAR);
|
||||||
const channelName = isChannel ? value : null;
|
const channelName = isChannel ? value : null;
|
||||||
let claimId;
|
let claimId;
|
||||||
|
@ -36,13 +39,13 @@ module.exports = {
|
||||||
let channelClaimId;
|
let channelClaimId;
|
||||||
if (modifierSeperator) {
|
if (modifierSeperator) {
|
||||||
if (!modifier) {
|
if (!modifier) {
|
||||||
throw new Error(`No modifier provided after separator ${modifierSeperator}.`);
|
throw new Error(`No modifier provided after separator "${modifierSeperator}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifierSeperator === ':') {
|
if (modifierSeperator === ':') {
|
||||||
channelClaimId = modifier;
|
channelClaimId = modifier;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`The ${modifierSeperator} modifier is not currently supported.`);
|
throw new Error(`The "${modifierSeperator}" modifier is not currently supported`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue