diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-05-05 14:22:53 -0700 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-05-05 14:22:53 -0700 |
| commit | 48ecd122ea6fb8cf12fb4029974c314e5d9efb62 (patch) | |
| tree | 88f90fa8c9d903f072a2b1c647c51a9899e520c7 /src/transport.c | |
| parent | 2218fd57a50ceb851cb131939bf0747e072e40f6 (diff) | |
| parent | 4ef14af93517b3842bc0dfa24147cf10dd029582 (diff) | |
| download | libgit2-48ecd122ea6fb8cf12fb4029974c314e5d9efb62.tar.gz | |
Merge pull request #659 from libgit2/development-merge
New-error-handling
Diffstat (limited to 'src/transport.c')
| -rw-r--r-- | src/transport.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/transport.c b/src/transport.c index 4910f2433..bc4248d5b 100644 --- a/src/transport.c +++ b/src/transport.c @@ -54,7 +54,8 @@ static git_transport_cb transport_find_fn(const char *url) int git_transport_dummy(git_transport **transport) { GIT_UNUSED(transport); - return git__throw(GIT_ENOTIMPLEMENTED, "This protocol isn't implemented. Sorry"); + giterr_set(GITERR_NET, "This transport isn't implemented. Sorry"); + return -1; } int git_transport_new(git_transport **out, const char *url) @@ -65,16 +66,17 @@ int git_transport_new(git_transport **out, const char *url) fn = transport_find_fn(url); - if (fn == NULL) - return git__throw(GIT_EINVALIDARGS, "Unsupported URL or non-existent path"); + if (fn == NULL) { + giterr_set(GITERR_NET, "Unsupported URL protocol"); + return -1; + } error = fn(&transport); if (error < GIT_SUCCESS) - return git__rethrow(error, "Failed to create new transport"); + return error; transport->url = git__strdup(url); - if (transport->url == NULL) - return GIT_ENOMEM; + GITERR_CHECK_ALLOC(transport->url); *out = transport; |
