Raise exception doctest build-finished handler if there was an error.

Refs #9874