Refactor the way errors are reported.