only call .toString() if err exists