PDA

View Full Version : How to catch the Error of GetVar("non-exist-var")?


bigboss97
31st August 2009, 14:42
I found something like "class NotFound". But I still can't figure out the syntax to catch the error in GetVar() when the variable doesn't exist. Any one can help?

Thanks

neuron2
31st August 2009, 14:43
try...catch?

Gavino
31st August 2009, 14:58
I assume you are referring to using the C++ API, not the script language.
try {
v = env->GetVar("varname");
...
}
catch (IScriptEnvironment::NotFound) {
// handle error
}

bigboss97
1st September 2009, 13:20
try {
v = env->GetVar("varname");
...
}
catch (IScriptEnvironment::NotFound) {
// handle error
}


That's exactly what I need
:thanks: