4.3.
ErrorObj Class
Up one level
Functions, members, and methods.
- Constant names and class member variable names are case-sensitive in PHP.
- Several MapScript functions (all those that access files in the back end such as ms_newMapObj(), drawMap(), etc.) will affect the value of the current working directory (CWD) in the PHP environment. This will be fixed eventually but in the meantime you should be careful about these side-effects.
Instances of errorObj are created internally by MapServer as errors
happen. Errors are managed as a chained list with the first item being
the most recent error. The head of the list can be fetched using
ms_GetErrorObj(), and the list can be cleared using ms_ResetErrorList()
Functions:
errorObj ms_GetErrorObj()
Returns a reference to the head of the list of errorObj.
void ms_ResetErrorList()
Clear the current error list.
Note that clearing the list invalidates any errorObj handles obtained
via the $error->next() method.
Members:
int code /* See error code constants above */
string routine
string message
Method:
errorObj next()
Returns the next errorObj in the list, or NULL if we reached the end
of the list.
Example:
This example draws a map and reports all errors generated during
the draw() call, errors can potentially come from multiple layers.
ms_ResetErrorList();
$img = $map->draw();
$error = ms_GetErrorObj();
while($error && $error->code != MS_NOERR)
{
printf("Error in %s: %s<br>\n", $error->routine, $error->message);
$error = $error->next();
}