Commit 378f630e authored by loring's avatar loring

python error message disambiguation

include attribute class and method name in error messages
generated within the python bindings


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@26809 18c085ea-50e0-402c-830e-de6fd14e8384
parent e43158f9
......@@ -2139,11 +2139,11 @@ class AttsGeneratorAttVector : public virtual AttVector , public virtual PythonG
c << " return NULL;" << Endl;
c << " if(index < 0 || (size_t)index >= obj->data->Get" << Name << "().size())" << Endl;
c << " {" << Endl;
c << " char msg[200];" << Endl;
c << " char msg[400] = {'\\0'};" << Endl;
c << " if(obj->data->Get" << Name << "().size() == 0)" << Endl;
c << " SNPRINTF(msg, 200, \"The index is invalid because " << name << " is empty.\");" << Endl;
c << " SNPRINTF(msg, 400, \"In " << className << "::Get" << Name << " : The index %d is invalid because " << name << " is empty.\", index);" << Endl;
c << " else" << Endl;
c << " SNPRINTF(msg, 200, \"The index is invalid. Use index values in: [0, %ld).\", obj->data->Get" << Name << "().size());" << Endl;
c << " SNPRINTF(msg, 400, \"In " << className << "::Get" << Name << " : The index %d is invalid. Use index values in: [0, %ld).\", index, obj->data->Get" << Name << "().size());" << Endl;
c << " PyErr_SetString(PyExc_IndexError, msg);" << Endl;
c << " return NULL;" << Endl;
c << " }" << Endl;
......@@ -2181,8 +2181,8 @@ class AttsGeneratorAttVector : public virtual AttVector , public virtual PythonG
c << " return NULL;" << Endl;
c << " if(!Py" << attType << "_Check(element))" << Endl;
c << " {" << Endl;
c << " char msg[400];" << Endl;
c << " SNPRINTF(msg, 400, \"The Add" << Name << " method only accepts " << attType << " objects.\");" << Endl;
c << " char msg[400] = {'\\0'};" << Endl;
c << " SNPRINTF(msg, 400, \"The " << className << "::Add" << Name << " method only accepts " << attType << " objects.\");" << Endl;
c << " PyErr_SetString(PyExc_TypeError, msg);" << Endl;
c << " return NULL;" << Endl;
c << " }" << Endl;
......@@ -2246,7 +2246,9 @@ class AttsGeneratorAttVector : public virtual AttVector , public virtual PythonG
else
c << " if(index < 0 || index >= obj->data->GetNum" << Name << plural << "())" << Endl;
c << " {" << Endl;
c << " PyErr_SetString(PyExc_IndexError, \"Index out of range\");" << Endl;
c << " char msg[400] = {'\\0'};" << Endl;
c << " SNPRINTF(msg, 400, \"In " << className << "::Remove" << Name << " : Index %d is out of range\", index);" << Endl;
c << " PyErr_SetString(PyExc_IndexError, msg);" << Endl;
c << " return NULL;" << Endl;
c << " }" << Endl;
c << Endl;
......
......@@ -111,11 +111,11 @@ ColorAttributeList_GetColors(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetColors().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetColors().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because colors is empty.");
SNPRINTF(msg, 400, "In ColorAttributeList::GetColors : The index %d is invalid because colors is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetColors().size());
SNPRINTF(msg, 400, "In ColorAttributeList::GetColors : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetColors().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -148,8 +148,8 @@ ColorAttributeList_AddColors(PyObject *self, PyObject *args)
return NULL;
if(!PyColorAttribute_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddColors method only accepts ColorAttribute objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The ColorAttributeList::AddColors method only accepts ColorAttribute objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -196,7 +196,9 @@ ColorAttributeList_RemoveColors(PyObject *self, PyObject *args)
ColorAttributeListObject *obj = (ColorAttributeListObject *)self;
if(index < 0 || index >= obj->data->GetNumColors())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In ColorAttributeList::RemoveColors : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -142,11 +142,11 @@ ColorControlPointList_GetControlPoints(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetControlPoints().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetControlPoints().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because controlPoints is empty.");
SNPRINTF(msg, 400, "In ColorControlPointList::GetControlPoints : The index %d is invalid because controlPoints is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetControlPoints().size());
SNPRINTF(msg, 400, "In ColorControlPointList::GetControlPoints : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetControlPoints().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -179,8 +179,8 @@ ColorControlPointList_AddControlPoints(PyObject *self, PyObject *args)
return NULL;
if(!PyColorControlPoint_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddControlPoints method only accepts ColorControlPoint objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The ColorControlPointList::AddControlPoints method only accepts ColorControlPoint objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -227,7 +227,9 @@ ColorControlPointList_RemoveControlPoints(PyObject *self, PyObject *args)
ColorControlPointListObject *obj = (ColorControlPointListObject *)self;
if(index < 0 || index >= obj->data->GetNumControlPoints())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In ColorControlPointList::RemoveControlPoints : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -185,11 +185,11 @@ ColorTableAttributes_GetColorTables(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetColorTables().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetColorTables().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because colorTables is empty.");
SNPRINTF(msg, 400, "In ColorTableAttributes::GetColorTables : The index %d is invalid because colorTables is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetColorTables().size());
SNPRINTF(msg, 400, "In ColorTableAttributes::GetColorTables : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetColorTables().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -222,8 +222,8 @@ ColorTableAttributes_AddColorTables(PyObject *self, PyObject *args)
return NULL;
if(!PyColorControlPointList_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddColorTables method only accepts ColorControlPointList objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The ColorTableAttributes::AddColorTables method only accepts ColorControlPointList objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -270,7 +270,9 @@ ColorTableAttributes_RemoveColorTables(PyObject *self, PyObject *args)
ColorTableAttributesObject *obj = (ColorTableAttributesObject *)self;
if(index < 0 || index >= obj->data->GetNumColorTables())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In ColorTableAttributes::RemoveColorTables : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -111,11 +111,11 @@ ExpressionList_GetExpressions(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetExpressions().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetExpressions().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because expressions is empty.");
SNPRINTF(msg, 400, "In ExpressionList::GetExpressions : The index %d is invalid because expressions is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetExpressions().size());
SNPRINTF(msg, 400, "In ExpressionList::GetExpressions : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetExpressions().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -148,8 +148,8 @@ ExpressionList_AddExpressions(PyObject *self, PyObject *args)
return NULL;
if(!PyExpression_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddExpressions method only accepts Expression objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The ExpressionList::AddExpressions method only accepts Expression objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -196,7 +196,9 @@ ExpressionList_RemoveExpressions(PyObject *self, PyObject *args)
ExpressionListObject *obj = (ExpressionListObject *)self;
if(index < 0 || index >= obj->data->GetNumExpressions())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In ExpressionList::RemoveExpressions : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -273,11 +273,11 @@ FileOpenOptions_GetOpenOptions(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetOpenOptions().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetOpenOptions().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because openOptions is empty.");
SNPRINTF(msg, 400, "In FileOpenOptions::GetOpenOptions : The index %d is invalid because openOptions is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetOpenOptions().size());
SNPRINTF(msg, 400, "In FileOpenOptions::GetOpenOptions : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetOpenOptions().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -310,8 +310,8 @@ FileOpenOptions_AddOpenOptions(PyObject *self, PyObject *args)
return NULL;
if(!PyDBOptionsAttributes_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddOpenOptions method only accepts DBOptionsAttributes objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The FileOpenOptions::AddOpenOptions method only accepts DBOptionsAttributes objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -358,7 +358,9 @@ FileOpenOptions_RemoveOpenOptions(PyObject *self, PyObject *args)
FileOpenOptionsObject *obj = (FileOpenOptionsObject *)self;
if(index < 0 || index >= obj->data->GetNumOpenOptions())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In FileOpenOptions::RemoveOpenOptions : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -111,11 +111,11 @@ GaussianControlPointList_GetControlPoints(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetControlPoints().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetControlPoints().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because controlPoints is empty.");
SNPRINTF(msg, 400, "In GaussianControlPointList::GetControlPoints : The index %d is invalid because controlPoints is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetControlPoints().size());
SNPRINTF(msg, 400, "In GaussianControlPointList::GetControlPoints : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetControlPoints().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -148,8 +148,8 @@ GaussianControlPointList_AddControlPoints(PyObject *self, PyObject *args)
return NULL;
if(!PyGaussianControlPoint_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddControlPoints method only accepts GaussianControlPoint objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The GaussianControlPointList::AddControlPoints method only accepts GaussianControlPoint objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -196,7 +196,9 @@ GaussianControlPointList_RemoveControlPoints(PyObject *self, PyObject *args)
GaussianControlPointListObject *obj = (GaussianControlPointListObject *)self;
if(index < 0 || index >= obj->data->GetNumControlPoints())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In GaussianControlPointList::RemoveControlPoints : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -719,11 +719,11 @@ MachineProfile_GetLaunchProfiles(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetLaunchProfiles().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetLaunchProfiles().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because launchProfiles is empty.");
SNPRINTF(msg, 400, "In MachineProfile::GetLaunchProfiles : The index %d is invalid because launchProfiles is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetLaunchProfiles().size());
SNPRINTF(msg, 400, "In MachineProfile::GetLaunchProfiles : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetLaunchProfiles().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -756,8 +756,8 @@ MachineProfile_AddLaunchProfiles(PyObject *self, PyObject *args)
return NULL;
if(!PyLaunchProfile_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddLaunchProfiles method only accepts LaunchProfile objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The MachineProfile::AddLaunchProfiles method only accepts LaunchProfile objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -804,7 +804,9 @@ MachineProfile_RemoveLaunchProfiles(PyObject *self, PyObject *args)
MachineProfileObject *obj = (MachineProfileObject *)self;
if(index < 0 || index >= obj->data->GetNumLaunchProfiles())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In MachineProfile::RemoveLaunchProfiles : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -111,11 +111,11 @@ PlotList_GetPlots(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetPlots().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetPlots().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because plots is empty.");
SNPRINTF(msg, 400, "In PlotList::GetPlots : The index %d is invalid because plots is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetPlots().size());
SNPRINTF(msg, 400, "In PlotList::GetPlots : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetPlots().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -148,8 +148,8 @@ PlotList_AddPlots(PyObject *self, PyObject *args)
return NULL;
if(!PyPlot_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddPlots method only accepts Plot objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The PlotList::AddPlots method only accepts Plot objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -196,7 +196,9 @@ PlotList_RemovePlots(PyObject *self, PyObject *args)
PlotListObject *obj = (PlotListObject *)self;
if(index < 0 || index >= obj->data->GetNumPlots())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In PlotList::RemovePlots : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -154,11 +154,11 @@ SelectionList_GetSelections(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetSelections().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetSelections().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because selections is empty.");
SNPRINTF(msg, 400, "In SelectionList::GetSelections : The index %d is invalid because selections is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetSelections().size());
SNPRINTF(msg, 400, "In SelectionList::GetSelections : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetSelections().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -191,8 +191,8 @@ SelectionList_AddSelections(PyObject *self, PyObject *args)
return NULL;
if(!PySelectionProperties_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddSelections method only accepts SelectionProperties objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The SelectionList::AddSelections method only accepts SelectionProperties objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -239,7 +239,9 @@ SelectionList_RemoveSelections(PyObject *self, PyObject *args)
SelectionListObject *obj = (SelectionListObject *)self;
if(index < 0 || index >= obj->data->GetNumSelections())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In SelectionList::RemoveSelections : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -269,11 +271,11 @@ SelectionList_GetSelectionSummary(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetSelectionSummary().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetSelectionSummary().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because selectionSummary is empty.");
SNPRINTF(msg, 400, "In SelectionList::GetSelectionSummary : The index %d is invalid because selectionSummary is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetSelectionSummary().size());
SNPRINTF(msg, 400, "In SelectionList::GetSelectionSummary : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetSelectionSummary().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -306,8 +308,8 @@ SelectionList_AddSelectionSummary(PyObject *self, PyObject *args)
return NULL;
if(!PySelectionSummary_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddSelectionSummary method only accepts SelectionSummary objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The SelectionList::AddSelectionSummary method only accepts SelectionSummary objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -354,7 +356,9 @@ SelectionList_RemoveSelectionSummary(PyObject *self, PyObject *args)
SelectionListObject *obj = (SelectionListObject *)self;
if(index < 0 || index >= obj->data->GetNumSelectionSummarys())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In SelectionList::RemoveSelectionSummary : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -161,11 +161,11 @@ SelectionSummary_GetVariables(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetVariables().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetVariables().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because variables is empty.");
SNPRINTF(msg, 400, "In SelectionSummary::GetVariables : The index %d is invalid because variables is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetVariables().size());
SNPRINTF(msg, 400, "In SelectionSummary::GetVariables : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetVariables().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -198,8 +198,8 @@ SelectionSummary_AddVariables(PyObject *self, PyObject *args)
return NULL;
if(!PySelectionVariableSummary_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddVariables method only accepts SelectionVariableSummary objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The SelectionSummary::AddVariables method only accepts SelectionVariableSummary objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -246,7 +246,9 @@ SelectionSummary_RemoveVariables(PyObject *self, PyObject *args)
SelectionSummaryObject *obj = (SelectionSummaryObject *)self;
if(index < 0 || index >= obj->data->GetNumVariables())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In SelectionSummary::RemoveVariables : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
......@@ -127,11 +127,11 @@ ViewerClientInformation_GetVars(PyObject *self, PyObject *args)
return NULL;
if(index < 0 || (size_t)index >= obj->data->GetVars().size())
{
char msg[200];
char msg[400] = {'\0'};
if(obj->data->GetVars().size() == 0)
SNPRINTF(msg, 200, "The index is invalid because vars is empty.");
SNPRINTF(msg, 400, "In ViewerClientInformation::GetVars : The index %d is invalid because vars is empty.", index);
else
SNPRINTF(msg, 200, "The index is invalid. Use index values in: [0, %ld).", obj->data->GetVars().size());
SNPRINTF(msg, 400, "In ViewerClientInformation::GetVars : The index %d is invalid. Use index values in: [0, %ld).", index, obj->data->GetVars().size());
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......@@ -164,8 +164,8 @@ ViewerClientInformation_AddVars(PyObject *self, PyObject *args)
return NULL;
if(!PyViewerClientInformationElement_Check(element))
{
char msg[400];
SNPRINTF(msg, 400, "The AddVars method only accepts ViewerClientInformationElement objects.");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "The ViewerClientInformation::AddVars method only accepts ViewerClientInformationElement objects.");
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
......@@ -212,7 +212,9 @@ ViewerClientInformation_RemoveVars(PyObject *self, PyObject *args)
ViewerClientInformationObject *obj = (ViewerClientInformationObject *)self;
if(index < 0 || index >= obj->data->GetNumVars())
{
PyErr_SetString(PyExc_IndexError, "Index out of range");
char msg[400] = {'\0'};
SNPRINTF(msg, 400, "In ViewerClientInformation::RemoveVars : Index %d is out of range", index);
PyErr_SetString(PyExc_IndexError, msg);
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment