Converts to helpful string in test env

If run in test env, the toString method will return a more helpful error message.