Note that in Google Forms, user-interface elements are visible only to an editor who opens the form to modify it, not to a user who opens the form to respond.
function onSubmit(e) {
try{
// Что-то делаем
throw "Тут происходит ошибка";
}catch(err){
FormApp.getActiveForm().setConfirmationMessage(`Ошибка! ${err}`);
};
}