diff -r 666f914201fb -r 2fe1408b6811 epoc32/include/hsexception.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/epoc32/include/hsexception.h Tue Mar 16 16:12:26 2010 +0000 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Updates applications and icons in Operator Tile. +* +*/ + + +#ifndef __HSEXCEPTION_H__ +#define __HSEXCEPTION_H__ + +#include + +namespace Hs { + +/** + * Class used to encapsulate error information thrown in exceptions by the + * Homescreen Publishing Api. + * @code + * + * ObserverClass* dataObserver = new ObserverClass(); + * try + * { + * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver ); + * if ( hsPublisher ) + * { + * HsWidget& widget = hsPublisher->createHsWidget( + * "templateName", "widgetName", "uniqueIdentifier" ); + * //attempt to create the widget again (with the same information) + * //will cause an exception + * hsPublisher->createHsWidget( + * "templateName", "widgetName", "uniqueIdentifier" ); + * } + * } + * catch (HsException& exception) + * { + * int errReason = exception.getReason(); + * //if the exception is thrown, becasue the widget attempted to + * //be created already exists the errReason will be KErrAlreadyExists + * } + * @endcode + */ +class HsException : public std::exception + { +public: + + /** + * Constructor of the HsException. + */ + IMPORT_C HsException( int aLeaveCode ); + + /** + * Destructor of the HsException. + */ + IMPORT_C virtual ~HsException(); + + /** + * Method retrieves the error information contained in the + * excpetion object. + * + * @code + * ObserverClass* dataObserver = new ObserverClass(); + * try + * { + * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher(dataObserver); + * hsPublisher->createHsWidget( + * "templateName", "widgetName", "uniqueIdentifier" ); + * } + * catch (HsException& exception) + * { + * int errReason = exception.getReason(); + * } + * @endcode + * @return Error code. + */ + IMPORT_C int getReason(); + +private: + + int mLeaveCode; + + }; +} + +#endif /*__HSEXCEPTION_H__*/