Error Reporting¶
When an eVision function fails, it throws an exception that contains an error code and a description.
eVision code throws exceptions of type
EException.NET Python.To catch a potential exception, include the function call in a try-catch block.
#include <eVision/Easy/EImageC24.h>
using namespace eVision;
try
{
// Image constructor
EImageC24 srcImage;
// ...
// Retrieve the pixel value at coordinates (56, 73)
EC24 value = srcImage.GetPixel(56, 730);
}
catch (EException exc)
{
// Retrieve the exception description
std::string error = exc.What();
}
using eVision;
try
{
// Image constructor
EImageC24 srcImage = new EImageC24();
// ...
// Retrieve the pixel value at coordinates (56, 73)
EC24 value = srcImage.GetPixel(56, 73);
}
catch (EException exc)
{
// Retrieve the exception description
string error = exc.What();
}
import eVision
try:
# Image constructor
src_image = eVision.EImageC24()
# ...
# Retrieve the pixel value at coordinates (56, 73)
value = src_image.GetPixel(56, 73)
except eVision.EException as e:
# Retrieve the exception description
error = str(e)
See also