Fix some edge cases

cc @sh1mmer @Matt-Esch
Are there other errors that also fall into this category, e.g. are an err and have no err.code? It seems like this could be an unreliable test.