Put error message in exception instead of stderr