Skip to content

Commit

Permalink
update error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
versun committed Sep 30, 2023
1 parent 49558bb commit 5605c72
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,39 +53,39 @@ async function create(event) {
to_lang: lang.value,
update: true
};
start_translate(payload,translation_process,translation_update)
url.value = null;
} else {
result.style.display = 'none';
//throw new Error(JSON.stringify(res));
throw new Error('Invalid RSS feed URL.\nPlease verify the URL and try again')
}

functions.createExecution(Appwrite_Function, JSON.stringify(payload))
} catch (error) {
error_msg.innerHTML = error.message.replace(/\n/g, '<br>');
console.error(error);
} finally {
loading.style.display = 'none';
}
}
async function start_translate(payload,translation_process,translation_update) {
functions.createExecution(Appwrite_Function, JSON.stringify(payload))
.then(res => {
//console.log(res);
if (res.responseBody != 'error') {
translation_update.innerHTML += ' ✔';
}else{
//translation_update.innerHTML += ' ✘';
translation_update.innerHTML += ' ✘ Ops,Please try again or feedback to us.';
console.error(res);
}
translation_process.style.display = 'none';
})
.catch(error => {
console.error(error);
translation_process.style.display = 'none';
//translation_update.innerHTML += ' ✘';
translation_update.innerHTML += ' ✘ Ops,Please try again or feedback to us.';
});

url.value = null;
} else {
result.style.display = 'none';
//throw new Error(JSON.stringify(res));
throw new Error('Invalid RSS feed URL.\nPlease verify the URL and try again')
}

} catch (error) {
error_msg.innerHTML = error.message.replace(/\n/g, '<br>');
console.error(error);
} finally {
loading.style.display = 'none';
}
}

function copy(event){
event.preventDefault();
const button = document.querySelector('#copy');
Expand Down

0 comments on commit 5605c72

Please sign in to comment.