print and exit on errors