Handle libgit2 errors by going to the error state