epoc32/include/hsexception.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Updates applications and icons in Operator Tile.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef __HSEXCEPTION_H__
williamr@2
    20
#define __HSEXCEPTION_H__
williamr@2
    21
williamr@2
    22
#include <exception>
williamr@2
    23
williamr@2
    24
namespace Hs {
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
 * Class used to encapsulate error information thrown in exceptions by the
williamr@2
    28
 * Homescreen Publishing Api.
williamr@2
    29
 * @code
williamr@2
    30
 * 
williamr@2
    31
 * ObserverClass* dataObserver = new ObserverClass();
williamr@2
    32
 * try 
williamr@2
    33
 * {
williamr@2
    34
 *     HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
williamr@2
    35
 *     if ( hsPublisher )
williamr@2
    36
 *     {
williamr@2
    37
 *         HsWidget& widget =  hsPublisher->createHsWidget( 
williamr@2
    38
 *             "templateName", "widgetName", "uniqueIdentifier" );
williamr@2
    39
 *         //attempt to create the widget again (with the same information) 
williamr@2
    40
 *         //will cause an exception
williamr@2
    41
 *         hsPublisher->createHsWidget( 
williamr@2
    42
 *             "templateName", "widgetName", "uniqueIdentifier" );
williamr@2
    43
 *     }
williamr@2
    44
 * }
williamr@2
    45
 * catch (HsException& exception)
williamr@2
    46
 * {
williamr@2
    47
 *     int errReason = exception.getReason();
williamr@2
    48
 *     //if the exception is thrown, becasue the widget attempted to
williamr@2
    49
 *     //be created already exists the errReason will be KErrAlreadyExists
williamr@2
    50
 * }
williamr@2
    51
 * @endcode
williamr@2
    52
 */
williamr@2
    53
class HsException : public std::exception
williamr@2
    54
    {
williamr@2
    55
public:
williamr@2
    56
	
williamr@2
    57
    /**
williamr@2
    58
     * Constructor of the HsException.
williamr@2
    59
     */
williamr@2
    60
	IMPORT_C HsException( int aLeaveCode );
williamr@2
    61
williamr@2
    62
    /**
williamr@2
    63
     * Destructor of the HsException.
williamr@2
    64
     */
williamr@2
    65
	IMPORT_C virtual ~HsException();
williamr@2
    66
    
williamr@2
    67
    /**
williamr@2
    68
     * Method retrieves the error information contained in the 
williamr@2
    69
     * excpetion object.
williamr@2
    70
     *
williamr@2
    71
     * @code
williamr@2
    72
     * ObserverClass* dataObserver = new ObserverClass();
williamr@2
    73
     * try 
williamr@2
    74
     * {
williamr@2
    75
     *     HsWidgetPublisher* hsPublisher = new HsWidgetPublisher(dataObserver);
williamr@2
    76
     *     hsPublisher->createHsWidget( 
williamr@2
    77
     *         "templateName", "widgetName", "uniqueIdentifier" );
williamr@2
    78
     * }
williamr@2
    79
     * catch (HsException& exception)
williamr@2
    80
     * {
williamr@2
    81
     *      int errReason = exception.getReason();
williamr@2
    82
     * }
williamr@2
    83
     * @endcode
williamr@2
    84
     * @return Error code.
williamr@2
    85
     */
williamr@2
    86
	IMPORT_C int getReason();
williamr@2
    87
williamr@2
    88
private:
williamr@2
    89
williamr@2
    90
	int mLeaveCode;
williamr@2
    91
    
williamr@2
    92
    };
williamr@2
    93
}
williamr@2
    94
williamr@2
    95
#endif /*__HSEXCEPTION_H__*/