8000 transport: provide a useful error message during cancellation by ethomson · Pull Request #6802 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

transport: provide a useful error message during cancellation #6802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By cl 8000 icking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libgit2/transports/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ static int local_push(
default:
last = git_error_last();

if (last && last->message)
if (last->klass != GIT_ERROR_NONE)
status->msg = git__strdup(last->message);
else
status->msg = git__strdup("Unspecified error encountered");
Expand Down
4 changes: 2 additions & 2 deletions src/libgit2/transports/ssh_libssh2.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ static int _git_ssh_authenticate_session(
return GIT_EAUTH;

if (rc != LIBSSH2_ERROR_NONE) {
if (!git_error_last())
ssh_error(session, "Failed to authenticate SSH session");
if (git_error_last()->klass == GIT_ERROR_NONE)
ssh_error(session, "failed to authenticate SSH session");
return -1;
}

Expand Down
6 changes: 3 additions & 3 deletions src/libgit2/transports/winhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static int certificate_check(winhttp_stream *s, int valid)

/* If there is no override, we should fail if WinHTTP doesn't think it's fine */
if (t->owner->connect_opts.callbacks.certificate_check == NULL && !valid) {
if (!git_error_last())
if (git_error_last()->klass == GIT_ERROR_NONE)
git_error_set(GIT_ERROR_HTTP, "unknown certificate check failure");

return GIT_ECERTIFICATE;
Expand All @@ -317,7 +317,7 @@ static int certificate_check(winhttp_stream *s, int valid)
if (error == GIT_PASSTHROUGH)
error = valid ? 0 : GIT_ECERTIFICATE;

if (error < 0 && !git_error_last())
if (error < 0 && git_error_last()->klass == GIT_ERROR_NONE)
git_error_set(GIT_ERROR_HTTP, "user cancelled certificate check");

return error;
Expand Down Expand Up @@ -961,7 +961,7 @@ static int send_request(winhttp_stream *s, size_t len, bool chunked)
(!request_failed && s->status_sending_request_reached)) {
git_error_clear();
if ((error = certificate_check(s, cert_valid)) < 0) {
if (!git_error_last())
if (git_error_last()->klass == GIT_ERROR_NONE)
git_error_set(GIT_ERROR_OS, "user cancelled certificate check");

return error;
Expand Down
Loading
0