[PATCH v3 07/15] libusbg: Add errors which may happen during parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 include/usbg/usbg.h |    4 ++++
 src/usbg.c          |   24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h
index 3a66ae3..3d3cba0 100644
--- a/include/usbg/usbg.h
+++ b/include/usbg/usbg.h
@@ -217,6 +217,10 @@ typedef enum  {
 	USBG_ERROR_BUSY = -8,
 	USBG_ERROR_NOT_SUPPORTED = -9,
 	USBG_ERROR_PATH_TOO_LONG = -10,
+	USBG_ERROR_INVALID_FORMAT = -11,
+	USBG_ERROR_MISSING_TAG = -12,
+	USBG_ERROR_INVALID_TYPE = -13,
+	USBG_ERROR_INVALID_VALUE = -14,
 	USBG_ERROR_OTHER_ERROR = -99
 } usbg_error;
 
diff --git a/src/usbg.c b/src/usbg.c
index c4a9308..cd526e1 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -217,6 +217,18 @@ const char *usbg_error_name(usbg_error e)
 	case USBG_ERROR_PATH_TOO_LONG:
 		ret = "USBG_ERROR_PATH_TOO_LONG";
 		break;
+	case USBG_ERROR_INVALID_FORMAT:
+		ret = "USBG_ERROR_INVALID_FORMAT";
+		break;
+	case USBG_ERROR_MISSING_TAG:
+		ret = "USBG_ERROR_MISSING_TAG";
+		break;
+	case USBG_ERROR_INVALID_TYPE:
+		ret = "USBG_ERROR_INVALUD_TYPE";
+		break;
+	case USBG_ERROR_INVALID_VALUE:
+		ret = "USBG_ERROR_INVALID_VALUE";
+		break;
 	case USBG_ERROR_OTHER_ERROR:
 		ret = "USBG_ERROR_OTHER_ERROR";
 		break;
@@ -263,6 +275,18 @@ const char *usbg_strerror(usbg_error e)
 	case USBG_ERROR_PATH_TOO_LONG:
 		ret = "Created path was too long to process it.";
 		break;
+	case USBG_ERROR_INVALID_FORMAT:
+		ret = "Given file has incompatible format.";
+		break;
+	case USBG_ERROR_MISSING_TAG:
+		ret = "One of mandatory tags is missing.";
+		break;
+	case USBG_ERROR_INVALID_TYPE:
+		ret = "One of attributes has incompatible type.";
+		break;
+	case USBG_ERROR_INVALID_VALUE:
+		ret = "Incorrect value provided as attribute.";
+		break;
 	case USBG_ERROR_OTHER_ERROR:
 		ret = "Other error";
 		break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux