I have this in my .bashrc:
function retry {
until $@; do :; done
alert
}
export -f retry
Works reasonably well for non-scripting usecases.