PathEngine home previous: iMeshFederationTileGeneratedCallBack::tileGenerated()next: iErrorHandler::handle()
Contents, API Reference, Interfaces, iErrorHandler

Interface iErrorHandler

Description

The client application creates objects derived from this interface to perform customised error handling.

Defined in SDKRoot/code/externalAPI/i_pathengine.h.

The client application supplies an object implementing this interface to be called in the case of error.

When an error occurs, the handler's handle() function will be called with details about the error.

When using the Microsoft CLR interface, the equivalent interface is PathEngine.ErrorHandler.

Methods:

handle

This method is called by PathEngine in the case of an error to perform application side error handling, normally by displaying or logging the error.

An example handler

Here is an example of how the handler might be implemented (taken from the tesbed):

#include <windows.h>
#include <stdio.h>
#include <string>
#include "i_pathengine.h"

class cMessageBoxErrorHandler : public iErrorHandler
{
public:
    int32_t handle(const char* error_type, const char* error_string, const char *const* attributes)
    {
        char title[1000];
        sprintf(title, "Error, type: %s", error_type);
        MessageBox(0, error_string, title, MB_OK);
        std::string attributes_string;
        if(attributes==0 || *attributes==0)
            return PE_ErrorHandler_Continue;
        while(*attributes)
        {
            attributes_string+="attribute \"";
            attributes_string+=*attributes;
            attributes_string+="\"=\"";
            attributes++;
            attributes_string+=*attributes;
            attributes_string+="\"\n";
            attributes++;
        }
        MessageBox(0, attributes_string.c_str(), "Error attributes", MB_OK);
        return PE_ErrorHandler_Continue;
    }
};

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: iErrorHandler::handle()