Format error messages with printf