fixed error handling for when daemon is down

This commit is contained in:
bill bittner 2017-10-12 14:01:46 -07:00
parent 8856ee5d0e
commit 0e498ff91c
2 changed files with 8 additions and 1 deletions

View file

@ -13,6 +13,11 @@ function showChannelCreateDoneDisplay() {
done.hidden = false;
}
function showChannelCreationError(msg) {
const inProgress = document.getElementById('channel-publish-in-progress');
inProgress.innerText = msg;
}
function publishNewChannel (event) {
const userName = document.getElementById('new-channel-name').value;
const password = document.getElementById('new-channel-password').value;
@ -42,11 +47,13 @@ function publishNewChannel (event) {
}
})
.catch(error => {
if (error.name === 'ChannelNameError' || error.name === 'ChannelPasswordError'){
const channelNameErrorDisplayElement = document.getElementById('input-error-channel-name');
showError(channelNameErrorDisplayElement, error.message);
} else {
console.log('signup failure:', error);
showChannelCreationError('Unfortunately, Spee.ch encountered an error while creating your channel :(');
}
})
}

View file

@ -210,7 +210,7 @@ function validateNewChannelSubmission(userName, password){
resolve();
} else {
console.log('channel is not available');
reject(new ChannelNameError('that channel name has already been taken'));
reject(new ChannelNameError('Sorry, that name is already taken'));
}
})
.catch( error => {