In Google Sheets (as with Excel, etc) if a user enters bad input into a formula, an error code will be printed in the offending cell and a small pop-up provides more detail
if (some_condition) { // will end execution with error throw 'Error. My custom error description.'; }