now returns a better error message when publish a doc fails

giving a better error message when publishing encounters an exception