MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / HandleHAPropsSIError

Function HandleHAPropsSIError

wrappers/MathCAD/CoolPropMathcad.cpp:586–603  ·  view source on GitHub ↗

Helper: centralize text-matching logic for HAPropsSI error handling

Source from the content-addressed store, hash-verified

584
585// Helper: centralize text-matching logic for HAPropsSI error handling
586static LRESULT HandleHAPropsSIError(const std::string& emsg, const std::string& OutName, const std::string& Prop1Name, const std::string& Prop2Name,
587 const std::string& Prop3Name) {
588 // Check for explicit parameter mentions first
589 if (emsg.find(OutName) != std::string::npos)
590 return MAKELRESULT(BAD_PARAMETER, 1);
591 else if (emsg.find(Prop1Name) != std::string::npos)
592 return MAKELRESULT(BAD_PARAMETER, 2);
593 else if (emsg.find(Prop2Name) != std::string::npos)
594 return MAKELRESULT(BAD_PARAMETER, 4);
595 else if (emsg.find(Prop3Name) != std::string::npos)
596 return MAKELRESULT(BAD_PARAMETER, 6);
597
598 // Specific HAPropsSI input-message case
599 if (emsg.find("at least one of the variables") != std::string::npos) return MAKELRESULT(HA_INPUTS, 2);
600
601 // Fallback: unknown error, let user inspect errstring
602 return MAKELRESULT(UNKNOWN, 1);
603}
604
605// This code executes the user function CP_HAPropsSI, which is a wrapper for
606// the CoolProp.HAPropsSI() function, used to extract humid air properties in base-SI units

Callers 1

CP_HAPropsSIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected