Only show error message when err != 0

fixes #307
Merge branch 'master' into brew