Suppress output unless non-zero exit code
You're going to have to buffer the output somewhere no matter what, since you need to wait for the exit code to know what to do. Something like this is probably easiest:
$ output=`my_long_noisy_script.sh 2>&1` || echo $output
The moreutils
package contains a program chronic
for this purpose. You just call it like
chronic my_program args ...
Very handy in cron jobs.