Revision as of 00:10, 2 September 2012 by lpvalente (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Using class CErrorUI to display error notes

From Nokia Developer Wiki
Jump to: navigation, search


Version Hint

Windows Phone: [[Category:Windows Phone]]
[[Category:Windows Phone 7.5]]
[[Category:Windows Phone 8]]

Nokia Asha: [[Category:Nokia Asha]]
[[Category:Nokia Asha Platform 1.0]]

Series 40: [[Category:Series 40]]
[[Category:Series 40 1st Edition]] [[Category:Series 40 2nd Edition]]
[[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]]
[[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]]
[[Category:Series 40 6th Edition (initial release)]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 Developer Platform 1.1]] [[Category:Series 40 Developer Platform 2.0]]

Symbian: [[Category:Symbian]]
[[Category:S60 1st Edition]] [[Category:S60 2nd Edition (initial release)]] [[Category:S60 2nd Edition FP1]] [[Category:S60 2nd Edition FP2]] [[Category:S60 2nd Edition FP3]]
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
[[Category:S60 5th Edition]]
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Nokia N93
Platform(s): S60 3rd Edition, FP1
S60 3rd Edition FP1
Keywords: CErrorUI, CErrorUI::NewL(), CErrorUI::ShowGlobalErrorNoteL(), CErrorUI::ShowGlobalErrorQueryL(), CErrorUI::TextResolver()
Created: aknyman (13 May 2008)
Last edited: lpvalente (02 Sep 2012)


This code snippet shows how the class CErrorUi is used to display error notes ("context : error text"). The context of the error can be the application or the subsystem where the error has occurred. The caller can self-define the context or it is automatically selected. The class CErrorUi maps the given error to the error text to be displayed and contains a reference to the internal CTextResolver instance.

  • ShowGlobalErrorNoteL() shows a global error note
  • ShowGlobalErrorQueryL() shows a global error query with the OK key
  • TextResolver() offers a reference to the internal TextResolver instance

Note: In the target device the ErrRd file is required to enable error notes. The correct location for the ErrRd file is in the c:\resource directory. The Wiki page How can I get extended information in error messages on Symbian shows how to create a SIS file to install the ErrRd file.

This snippet can be self-signed.

MMP file

The following libraries are required:

LIBRARY commonui.lib

Header file

#ifndef __TESTERAPPUI_H__
#define __TESTERAPPUI_H__
#include <aknappui.h>
class CErrorUI;
class CTesterAppView : public CCoeControl
// Functions from base classes
void HandleCommandL(TInt aCommand);
void DoHandleCommandL(TInt aCommand);
CErrorUI* iErrorUi;
#endif // __TESTERAPPUI_H__

Source file

#include <errorui.h>
void CTesterAppUi::ConstructL()
iErrorUi = CErrorUI::NewL();
delete iErrorUi;
void CTesterAppUi::HandleCommandL(TInt aCommand)
switch (aCommand)
case EEikCmdExit:
case EAknSoftkeyExit:
case ECommand1:
TRAPD( errNote, DoHandleCommandL( aCommand ) );
if ( errNote )
iErrorUi->ShowGlobalErrorNoteL( errNote );
TPtrC errorMessage( iErrorUi->TextResolver().ResolveErrorString( errNote ) );
// do something with the error message...
// KErrNone, do something....
case ECommand2:
TRAPD( errQuery, DoHandleCommandL( aCommand ) );
if ( errQuery )
iErrorUi->ShowGlobalErrorQueryL( errQuery );
TPtrC errorMessage( iErrorUi->TextResolver().ResolveErrorString( errQuery ) );
// do something with the error message...
// KErrNone, do something....
void CTesterAppUi::DoHandleCommandL(TInt aCommand)
//Do Something that might leave...
User::Leave(KErrNotSupported );


The class CErrorUi shows a global error note or a global error query when the method called by the user leaves.

See also

Archived:Using CTextResolver to resolve error texts

How can I get extended information in error messages on Symbian

This page was last modified on 2 September 2012, at 00:10.
37 page views in the last 30 days.