1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/hsexception.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,95 @@
1.4 +/*
1.5 +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Updates applications and icons in Operator Tile.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef __HSEXCEPTION_H__
1.23 +#define __HSEXCEPTION_H__
1.24 +
1.25 +#include <exception>
1.26 +
1.27 +namespace Hs {
1.28 +
1.29 +/**
1.30 + * Class used to encapsulate error information thrown in exceptions by the
1.31 + * Homescreen Publishing Api.
1.32 + * @code
1.33 + *
1.34 + * ObserverClass* dataObserver = new ObserverClass();
1.35 + * try
1.36 + * {
1.37 + * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
1.38 + * if ( hsPublisher )
1.39 + * {
1.40 + * HsWidget& widget = hsPublisher->createHsWidget(
1.41 + * "templateName", "widgetName", "uniqueIdentifier" );
1.42 + * //attempt to create the widget again (with the same information)
1.43 + * //will cause an exception
1.44 + * hsPublisher->createHsWidget(
1.45 + * "templateName", "widgetName", "uniqueIdentifier" );
1.46 + * }
1.47 + * }
1.48 + * catch (HsException& exception)
1.49 + * {
1.50 + * int errReason = exception.getReason();
1.51 + * //if the exception is thrown, becasue the widget attempted to
1.52 + * //be created already exists the errReason will be KErrAlreadyExists
1.53 + * }
1.54 + * @endcode
1.55 + */
1.56 +class HsException : public std::exception
1.57 + {
1.58 +public:
1.59 +
1.60 + /**
1.61 + * Constructor of the HsException.
1.62 + */
1.63 + IMPORT_C HsException( int aLeaveCode );
1.64 +
1.65 + /**
1.66 + * Destructor of the HsException.
1.67 + */
1.68 + IMPORT_C virtual ~HsException();
1.69 +
1.70 + /**
1.71 + * Method retrieves the error information contained in the
1.72 + * excpetion object.
1.73 + *
1.74 + * @code
1.75 + * ObserverClass* dataObserver = new ObserverClass();
1.76 + * try
1.77 + * {
1.78 + * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher(dataObserver);
1.79 + * hsPublisher->createHsWidget(
1.80 + * "templateName", "widgetName", "uniqueIdentifier" );
1.81 + * }
1.82 + * catch (HsException& exception)
1.83 + * {
1.84 + * int errReason = exception.getReason();
1.85 + * }
1.86 + * @endcode
1.87 + * @return Error code.
1.88 + */
1.89 + IMPORT_C int getReason();
1.90 +
1.91 +private:
1.92 +
1.93 + int mLeaveCode;
1.94 +
1.95 + };
1.96 +}
1.97 +
1.98 +#endif /*__HSEXCEPTION_H__*/