handle error case for PM_ERR_LIBCURL

Add PM_ERR_LIBCURL to error enum and handle case in error.c by returning
curl_easy_strerror() based on the error number carried by the gloabl alpm
handle.

Signed-off-by: Dave Reisner <d@falconindy.com>
This commit is contained in:
Dave Reisner 2011-01-15 15:38:16 -05:00
parent a5b6a75787
commit 8a58648471
2 changed files with 9 additions and 0 deletions

View file

@ -535,6 +535,7 @@ enum _pmerrno_t {
/* External library errors */
PM_ERR_LIBARCHIVE,
PM_ERR_LIBFETCH,
PM_ERR_LIBCURL,
PM_ERR_EXTERNAL_DOWNLOAD
};

View file

@ -39,6 +39,7 @@
/* libalpm */
#include "util.h"
#include "alpm.h"
#include "handle.h"
const char SYMEXPORT *alpm_strerrorlast(void)
{
@ -157,6 +158,13 @@ const char SYMEXPORT *alpm_strerror(int err)
#else
/* obviously shouldn't get here... */
return _("download library error");
#endif
case PM_ERR_LIBCURL:
#ifdef HAVE_LIBCURL
return(curl_easy_strerror(handle->curlerr));
#else
/* obviously shouldn't get here... */
return _("download library error");
#endif
case PM_ERR_EXTERNAL_DOWNLOAD:
return _("error invoking external downloader");