Namespaces
Variants
Actions

Archived:Using class CErrorUI to display error notes

Jump to: navigation, search


Archived.png
Archived: 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

Compatibility
Platform(s): S60 3rd Edition, FP1

Article
Keywords: CErrorUI, CErrorUI::NewL(), CErrorUI::ShowGlobalErrorNoteL(), CErrorUI::ShowGlobalErrorQueryL(), CErrorUI::TextResolver()
Created: aknyman (13 May 2008)
Last edited: lpvalente (02 Sep 2012)

Contents

Overview

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__
 
// INCLUDES
#include <aknappui.h>
 
// FORWARD DECLARATIONS
class CErrorUI;
 
 
class CTesterAppView : public CCoeControl
{
private:
// Functions from base classes
void HandleCommandL(TInt aCommand);
//...
void DoHandleCommandL(TInt aCommand);
//...
private:
CErrorUI* iErrorUi;
};
 
#endif // __TESTERAPPUI_H__

Source file

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


Postconditions

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.
160 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved