g_debug("%s: CR_CW_AUTO_DETECT_COMPRESSION cannot be used if "
"mode is CR_CW_MODE_WRITE", __func__);
assert(0);
+ g_set_error(err, CR_COMPRESSION_WRAPPER_ERROR, CRE_ASSERT,
+ "CR_CW_AUTO_DETECT_COMPRESSION cannot be used if "
+ "mode is CR_CW_MODE_WRITE");
+ return NULL;
}
if (comtype == CR_CW_UNKNOWN_COMPRESSION) {
g_debug("%s: CR_CW_UNKNOWN_COMPRESSION cannot be used if mode"
- " is CR_CW_MODE_WRITE", __func__);
+ " is CR_CW_MODE_WRITE", __func__);
assert(0);
+ g_set_error(err, CR_COMPRESSION_WRAPPER_ERROR, CRE_ASSERT,
+ "CR_CW_UNKNOWN_COMPRESSION cannot be used if mode "
+ "is CR_CW_MODE_WRITE");
+ return NULL;
}
}
(23) OpenSSL library related error */
CRE_CURL, /*!<
(24) Curl library related error */
+ CRE_ASSERT, /*!<
+ (25) Ideally this error should never happend. Nevertheless if
+ it happend, probable reason is that some values of createrepo_c
+ object was changed (by you - a programmer) in a bad way */
} cr_Error;
/** Converts cr_Error return code to error string.
// and it SHOULD set only valid key values)
g_critical("%s: Unknown hash table key selected", __func__);
assert(0);
- return CRE_ERROR;
+ g_set_error(err, CR_LOAD_METADATA_ERROR, CRE_ASSERT,
+ "Bad db type");
+ return CRE_ASSERT;
}
if (g_hash_table_lookup(md->ht, new_key)) {
db_create_other_tables(db, &tmp_err);
break;
default:
+ g_critical("%s: Bad db_type", __func__);
assert(0);
+ g_set_error(err, CR_DB_ERROR, CRE_ASSERT, "Bad db type");
+ return NULL;
}
if (tmp_err) {
statements = cr_db_prepare_other_statements(db, &tmp_err);
break;
default:
+ g_critical("%s: Bad db_type", __func__);
assert(0);
+ g_set_error(err, CR_DB_ERROR, CRE_ASSERT, "Bad db type");
+ return NULL;
}
if (tmp_err) {
return NULL;
}
- sqlitedb = g_new0(cr_SqliteDb, 1);
- sqlitedb->db = db;
- sqlitedb->type = db_type;
+ sqlitedb = g_new0(cr_SqliteDb, 1);
+ sqlitedb->db = db;
+ sqlitedb->type = db_type;
switch (db_type) {
case CR_DB_PRIMARY:
sqlitedb->statements.oth = statements;
break;
default:
+ g_critical("%s: Bad db_type", __func__);
assert(0);
+ g_set_error(err, CR_DB_ERROR, CRE_ASSERT, "Bad db type");
+ return NULL;
}
return sqlitedb;
cr_db_destroy_other_statements(sqlitedb->statements.oth);
break;
default:
+ g_critical("%s: Bad db type", __func__);
assert(0);
+ g_set_error(err, CR_DB_ERROR, CRE_ASSERT, "Bad db type");
+ return CRE_ASSERT;
}
if (tmp_err) {
cr_db_add_other_pkg(sqlitedb->statements.oth, pkg, &tmp_err);
break;
default:
+ g_critical("%s: Bad db type", __func__);
assert(0);
+ g_set_error(err, CR_DB_ERROR, CRE_ASSERT, "Bad db type");
+ return CRE_ASSERT;
}
if (tmp_err) {
xml_header = XML_OTHER_HEADER;
break;
default:
+ g_critical("%s: Bad file type", __func__);
assert(0);
+ g_set_error(err, CR_XML_FILE_ERROR, CRE_ASSERT, "Bad file type");
+ return CRE_ASSERT;
}
if (cr_printf(&tmp_err, f->f, xml_header, f->pkgs) == CR_CW_ERR) {
xml_footer = XML_OTHER_FOOTER;
break;
default:
+ g_critical("%s: Bad file type", __func__);
assert(0);
+ g_set_error(err, CR_XML_FILE_ERROR, CRE_ASSERT, "Bad file type");
+ return CRE_ASSERT;
}
cr_puts(f->f, xml_footer, &tmp_err);
xml = cr_xml_dump_other(pkg, &tmp_err);
break;
default:
- assert(0); // This shoud not happend
+ g_critical("%s: Bad file type", __func__);
+ assert(0);
+ g_set_error(err, CR_XML_FILE_ERROR, CRE_ASSERT, "Bad file type");
+ return CRE_ASSERT;
}
if (tmp_err) {