Symbian
Symbian OS Library

FAQ-0915 Why shouldn't I call iEikonEnv->HandleError() in my application

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Applications
Created: 08/12/2003 Modified: 10/16/2003
Number: FAQ-0915
Platform: Not Applicable

Question:
Why shouldn't I call iEikonEnv->HandleError() in my application
How should I handle errors?


Answer:
** Why shouldn't I call iEikonEnv->HandleError()?
The function CEikonEnv::HandleError(error) is Symbian internal, and not intended for use by applications. Applications using this function may crash unexpectedly.

** How should I handle errors?

The method you use to handle errors depends on the type of error, and what you are trying to achieve when an error occurs.

The most common reason for handling an error is for cleanup, i.e. to put an application into a good state after an error has occured. In this case, the usual method is to ensure that everything is held on the cleanup stack (or as a member of an object that is on the stack), and then calling User::Leave() or User::LeaveIfError() if an error occurs. The active scheduler will then unwind the callstack, correctly deleting all objects.

By default, the error that occured is resolved and displayed in an alert window.

If you wish to implement different (application-specific) error handling, then you can do so by implementing the following function in your AppUi (called here CMyAppUi) class:
TErrorHandlerResponse CMyAppUi::HandleError(TInt aError,const SExtendedError& aExtErr,TDes& aErrorText,TDes& aContextText);
The function ...

Note that for UIQ, you must derive from CQikAppUi, not the CEikAppUi.