TRY {
res = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
+ if (e.category == not_found_error) {
found = 1;
xbt_ex_free(e);
} else {
* @arg name the name of the elem to be freed
*
* Note that it removes both the description and the actual content.
+ * Throws not_found when no such element exists.
*/
-xbt_error_t
+void
xbt_cfg_unregister(xbt_cfg_t cfg,const char *name) {
- return xbt_dict_remove((xbt_dict_t)cfg,name);
+ xbt_dict_remove((xbt_dict_t)cfg,name);
}
/**
TRY {
res = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
- THROW1(mismatch_error,0,
- "No registered variable '%s' in this config set",name);
+ if (e.category == not_found_error) {
xbt_ex_free(e);
+ THROW1(not_found_error,0,
+ "No registered variable '%s' in this config set",name);
}
RETHROW;
}
TRY {
variable = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
- THROW1(mismatch_error,0,
- "Can't get the type of '%s' since this variable does not exist",name);
+ if (e.category == not_found_error) {
xbt_ex_free(e);
+ THROW1(not_found_error,0,
+ "Can't get the type of '%s' since this variable does not exist",name);
}
RETHROW;
}
TRY {
type = xbt_cfg_get_type(cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
+ if (e.category == not_found_error) {
xbt_ex_free(e);
- THROW1(mismatch_error,0,"Can't set the property '%s' since it's not registered",name);
+ THROW1(not_found_error,0,"Can't set the property '%s' since it's not registered",name);
}
RETHROW;
}
variable = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
free(optionlist_cpy);
- if (e.category == mismatch_error) {
+ if (e.category == not_found_error) {
xbt_ex_free(e);
- THROW1(mismatch_error,0,"No registrated variable corresponding to '%s'.",name);
+ THROW1(not_found_error,0,"No registrated variable corresponding to '%s'.",name);
}
RETHROW;
}
}
}
- THROW2(mismatch_error,0,
+ THROW2(not_found_error,0,
"Can't remove the value %d of config element %s: value not found.",val,name);
}
}
}
- THROW2(mismatch_error,0,
+ THROW2(not_found_error,0,
"Can't remove the value %f of config element %s: value not found.",val,name);
}
}
}
- THROW2(mismatch_error,0,
+ THROW2(not_found_error,0,
"Can't remove the value %s of config element %s: value not found.",val,name);
}
}
}
- THROW3(mismatch_error,0,
+ THROW3(not_found_error,0,
"Can't remove the value %s:%d of config element %s: value not found.",
host,port,name);
}
TRY {
variable = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
- xbt_ex_free(e);
- THROW1(mismatch_error,0,
- "Can't empty '%s' since this config element does not exist", name);
- }
- RETHROW;
+ if (e.category != not_found_error)
+ RETHROW;
+
+ xbt_ex_free(e);
+ THROW1(not_found_error,0,
+ "Can't empty '%s' since this config element does not exist", name);
}
if (variable) {
TRY {
variable = xbt_dict_get((xbt_dict_t)cfg,name);
} CATCH(e) {
- if (e.category == mismatch_error) {
+ if (e.category == not_found_error) {
xbt_ex_free(e);
- THROW1(mismatch_error,0,
+ THROW1(not_found_error,0,
"No registered variable %s in this config set",name);
}
RETHROW;