Tidy up test error handling, hopefully.