secureswitools/swisistools/source/interpretsislib/errors.h
changeset 0 ba25891c3a9e
child 24 5cc91383ab1e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file ERRORS.H
       
    21  @publishedPartner
       
    22  @released
       
    23 */
       
    24 #ifndef	ERRORS_H
       
    25 #define	ERRORS_H
       
    26 
       
    27 #pragma warning (disable: 4786)
       
    28 
       
    29 #include <stdexcept>
       
    30 // System includes
       
    31 #include <string>
       
    32 
       
    33 // User includes
       
    34 #include "is_utils.h"
       
    35 
       
    36 
       
    37 
       
    38 enum ErrorCodes
       
    39     {
       
    40 	SUCCESS = 0,
       
    41 	MISSING_DEPENDENCY = -1,
       
    42 	SIS_NOT_SUPPORTED = -2,
       
    43 	ATTEMPT_TO_UPGRADE_ROM_PKG = -3,
       
    44 	DATA_CAGE_VIOLATION = -4,
       
    45 	ECLIPSING_VIOLATION = -5,
       
    46 	FILE_ERROR = -6,
       
    47 	CMDLINE_ERROR = -7,
       
    48 	OVERWRITE_ORPHAN = -8,
       
    49 	DUPLICATE_SID = -9,
       
    50 	INVALID_SIS = -10,
       
    51 	STD_EXCEPTION = -11,
       
    52 	UNKNOWN_EXCEPTION = -12,
       
    53     CONFIG_ERROR = -13,
       
    54     ROM_MANAGER = -14,
       
    55     DIRECTORY_CREATION_ERROR = -15,
       
    56 	PA_NO_TARGET_FILE = -16,
       
    57 	ATTEMPT_TO_UNINSTALL_ROM_PKG = -17,
       
    58 	INVALID_UPGRADE = -18,
       
    59 	INVALID_REGISTRY_VERSION = -19,
       
    60 	SISREGISTRY_ERROR = -20,
       
    61 	MISSING_BASE_PACKAGE = -21,
       
    62 	PACKAGE_NOT_FOUND = -22,
       
    63 	ENV_NOT_SPECIFIED = -23,
       
    64 	DB_EXCEPTION = -24,
       
    65 	
       
    66 	// errors related to database registration
       
    67 	GLOBALID_CREATION_ERROR = -40,
       
    68 	DATABASE_ENTRY_MISSING = -41,
       
    69 	DATABASE_UPDATE_FAILED = -42,
       
    70 	LIBRARYLOAD_ERROR = -43
       
    71     };
       
    72 
       
    73 
       
    74 class InterpretSisError : public std::runtime_error
       
    75     {
       
    76 public:
       
    77 	inline InterpretSisError()
       
    78         : std::runtime_error( "InterpretSis Error" ), iCode( SUCCESS )
       
    79         {
       
    80         }
       
    81 
       
    82     inline InterpretSisError( const std::string& aError, ErrorCodes aCode )
       
    83         : std::runtime_error( aError ), iCode( aCode )
       
    84         {
       
    85         }
       
    86 
       
    87 	inline InterpretSisError( const std::wstring& aError, ErrorCodes aCode )
       
    88         : std::runtime_error( Ucs2ToUtf8(aError) ), iCode( aCode )
       
    89         {
       
    90         }
       
    91 
       
    92 public:
       
    93 	ErrorCodes GetErrorCode() const { return iCode; }
       
    94 
       
    95 private:
       
    96 	ErrorCodes iCode;
       
    97     };
       
    98 
       
    99 /** 
       
   100  * @internalComponent
       
   101  * @released
       
   102  */
       
   103 class InvalidSis : public InterpretSisError
       
   104     {
       
   105 public:
       
   106 	inline InvalidSis( const std::string& aPackage, const std::string& aError, ErrorCodes aErr )
       
   107         : InterpretSisError(aPackage + " - " + aError, aErr) 
       
   108         {
       
   109         }
       
   110     };
       
   111 
       
   112 
       
   113 #endif	/* ERRORS_H */