Tidy up error reporting a bit.