williamr@2: /* williamr@2: * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Updates applications and icons in Operator Tile. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __HSEXCEPTION_H__ williamr@2: #define __HSEXCEPTION_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: namespace Hs { williamr@2: williamr@2: /** williamr@2: * Class used to encapsulate error information thrown in exceptions by the williamr@2: * Homescreen Publishing Api. williamr@2: * @code williamr@2: * williamr@2: * ObserverClass* dataObserver = new ObserverClass(); williamr@2: * try williamr@2: * { williamr@2: * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver ); williamr@2: * if ( hsPublisher ) williamr@2: * { williamr@2: * HsWidget& widget = hsPublisher->createHsWidget( williamr@2: * "templateName", "widgetName", "uniqueIdentifier" ); williamr@2: * //attempt to create the widget again (with the same information) williamr@2: * //will cause an exception williamr@2: * hsPublisher->createHsWidget( williamr@2: * "templateName", "widgetName", "uniqueIdentifier" ); williamr@2: * } williamr@2: * } williamr@2: * catch (HsException& exception) williamr@2: * { williamr@2: * int errReason = exception.getReason(); williamr@2: * //if the exception is thrown, becasue the widget attempted to williamr@2: * //be created already exists the errReason will be KErrAlreadyExists williamr@2: * } williamr@2: * @endcode williamr@2: */ williamr@2: class HsException : public std::exception williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Constructor of the HsException. williamr@2: */ williamr@2: IMPORT_C HsException( int aLeaveCode ); williamr@2: williamr@2: /** williamr@2: * Destructor of the HsException. williamr@2: */ williamr@2: IMPORT_C virtual ~HsException(); williamr@2: williamr@2: /** williamr@2: * Method retrieves the error information contained in the williamr@2: * excpetion object. williamr@2: * williamr@2: * @code williamr@2: * ObserverClass* dataObserver = new ObserverClass(); williamr@2: * try williamr@2: * { williamr@2: * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher(dataObserver); williamr@2: * hsPublisher->createHsWidget( williamr@2: * "templateName", "widgetName", "uniqueIdentifier" ); williamr@2: * } williamr@2: * catch (HsException& exception) williamr@2: * { williamr@2: * int errReason = exception.getReason(); williamr@2: * } williamr@2: * @endcode williamr@2: * @return Error code. williamr@2: */ williamr@2: IMPORT_C int getReason(); williamr@2: williamr@2: private: williamr@2: williamr@2: int mLeaveCode; williamr@2: williamr@2: }; williamr@2: } williamr@2: williamr@2: #endif /*__HSEXCEPTION_H__*/