Improved error diagnostics for printing.