-
Notifications
You must be signed in to change notification settings - Fork 93
Createrepo_c Error Reporting
Tomas Mlcoch edited this page Sep 9, 2013
·
7 revisions
- Createrepo_c uses Glib2 error reporting style.
- Definitely look at the error.h
- CR_DB_ERROR
- CR_XML_DUMP_PRIMARY_ERROR
- CR_XML_DUMP_FILELISTS_ERROR
- CR_XML_DUMP_OTHER_ERROR
- ... (All return domains could be found in error.h)
- (0) CR_OK
- ... (All return codes could be found in error.h)
- Programming errors are not reported by GError (createrepo_c lib uses asserts to prevent programming errors).
- NULL could be safely passed instead of GError** for every createrepo_c lib function.
- If an error is reported via GError then output param(s) shoud be empty (e.g. NULL value).
- If GError is used, it MUST be initialized to NULL (GError *err = NULL).
cr_Package *pkg;
GError *err = NULL; // It's necessary to set err to NULL!
cr_package_parser_init();
pkg = cr_package_from_rpm("foopkg.rpm",
CR_SHA256,
"packages/foopkg.rpm",
NULL,
5,
NULL,
&err);
cr_package_parser_cleanup();
if (err != NULL) {
printf("Error occured: %d (%s)", err->code, err->msg);
g_error_free(err);
return 1;
}
return 0;