pretty print should exit with error code when invalid

Fixes issue #38.