Correct get_parameter_information_string, fixes #974

Put the catch in a more useful way and solves the call to CoolProp::get_parameter_information.
This commit is contained in:
JonWel
2016-02-15 01:03:21 +01:00
parent a81cf6a9d9
commit 763d4ceb11

View File

@@ -251,15 +251,12 @@ EXPORT_CODE long CONVENTION get_parameter_information_string(const char *param,
{
try{
int key = CoolProp::get_parameter_index(param);
if (key >= 0){
std::string s = CoolProp::get_parameter_information(key, Output);
return str2buf(s, Output, n) ? 1 : 0;
}
else{
str2buf(format("parameter is invalid: %s", param), Output, n);
}
std::string s = CoolProp::get_parameter_information(key, "long");
return str2buf(s, Output, n) ? 1 : 0;
}
catch(...){}
catch(...){
str2buf(format("parameter is invalid: %s", param), Output, n);
}
return 0;
}
EXPORT_CODE long CONVENTION get_fluid_param_string(const char *fluid, const char *param, char * Output, int n)
@@ -607,4 +604,4 @@ EMSCRIPTEN_BINDINGS(coolprop_lib_bindings) {
function("F2K", &F2K);
}
#endif
#endif