summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libimobiledevice/libimobiledevice.h9
-rw-r--r--src/idevice.c25
2 files changed, 34 insertions, 0 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
index 897aa37..8df3fed 100644
--- a/include/libimobiledevice/libimobiledevice.h
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -404,6 +404,15 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_get_handle(idevice_t device, uint32
404LIBIMOBILEDEVICE_API idevice_error_t idevice_get_udid(idevice_t device, char **udid); 404LIBIMOBILEDEVICE_API idevice_error_t idevice_get_udid(idevice_t device, char **udid);
405 405
406/** 406/**
407 * Gets a readable error string for a given idevice error code.
408 *
409 * @param err An idevice error code
410 *
411 * @return A readable error string
412 */
413LIBIMOBILEDEVICE_API const char* idevice_strerror(idevice_error_t err);
414
415/**
407 * Returns a static string of the libimobiledevice version. 416 * Returns a static string of the libimobiledevice version.
408 * 417 *
409 * @return The libimobiledevice version as static ascii string 418 * @return The libimobiledevice version as static ascii string
diff --git a/src/idevice.c b/src/idevice.c
index d07b691..e9c909f 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -1534,3 +1534,28 @@ idevice_error_t idevice_connection_disable_bypass_ssl(idevice_connection_t conne
1534 1534
1535 return IDEVICE_E_SUCCESS; 1535 return IDEVICE_E_SUCCESS;
1536} 1536}
1537
1538const char* idevice_strerror(idevice_error_t err)
1539{
1540 switch (err) {
1541 case IDEVICE_E_SUCCESS:
1542 return "Success";
1543 case IDEVICE_E_INVALID_ARG:
1544 return "Invalid argument";
1545 case IDEVICE_E_UNKNOWN_ERROR:
1546 return "Unknown Error";
1547 case IDEVICE_E_NO_DEVICE:
1548 return "No device";
1549 case IDEVICE_E_NOT_ENOUGH_DATA:
1550 return "Not enough data";
1551 case IDEVICE_E_CONNREFUSED:
1552 return "Connection refused";
1553 case IDEVICE_E_SSL_ERROR:
1554 return "SSL error";
1555 case IDEVICE_E_TIMEOUT:
1556 return "Timeout";
1557 default:
1558 break;
1559 }
1560 return "Unknown Error";
1561}