secureswitools/swisistools/source/sisxlibrary/exception.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 * Note: This file may contain code to generate corrupt files for test purposes.
       
    16 * Such code is excluded from production builds by use of compiler defines;
       
    17 * it is recommended that such code should be removed if this code is ever published publicly.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @internalComponent
       
    25  @released
       
    26 */
       
    27 
       
    28 #include "exception.h"
       
    29 
       
    30 // NOTE:
       
    31 // If makesis really does suffer from out of memory problems, this code will need to be
       
    32 // made more sophisticated
       
    33 
       
    34 
       
    35 const wchar_t* CSISException::widewhat() const throw()
       
    36 	{
       
    37 	static std::wstring description;
       
    38 	switch (iCategory)
       
    39 		{
       
    40 	case EFileFormat:
       
    41 		description = L"SISfile error";
       
    42 		break;
       
    43 	case EVerification:
       
    44 		description = L"verification failure";
       
    45 		break;
       
    46 	case EMemory:
       
    47 		description = L"memory error";
       
    48 		break;
       
    49 	case EFileProblem:
       
    50 		description = L"file I/O fault";
       
    51 		break;
       
    52 	case ESyntax:
       
    53 		description = L"syntax error";
       
    54 		break;
       
    55 	case ECompress:
       
    56 		description = L"compression fault";
       
    57 		break;
       
    58 	case ELanguage:
       
    59 		description = L"bad language count";
       
    60 		break;
       
    61 	case EUID:
       
    62 		description = L"different UID";
       
    63 		break;
       
    64 	case EInvalidDestination:
       
    65 		description = L"invalid destination path or syntax";
       
    66 		break;
       
    67 	case EInvalidInstallOption:
       
    68 		description = L"Invalid Install Option";
       
    69 		break;
       
    70 	case ENotSigned :
       
    71 		description = L"not signed";
       
    72 		break;
       
    73 	case EDirIsFile:
       
    74 		description = L"directory specified is a file";
       
    75 		break;
       
    76 	case EPermissionDenied:
       
    77 		description = L"permission was denied when using directory/file";
       
    78 		break;
       
    79 	case ENotSupported:
       
    80 		description = L"operation not supported";
       
    81 		break;
       
    82 	case ECrypto:
       
    83 		description = L"encryption error";
       
    84 		break;
       
    85 		}
       
    86 	
       
    87 	description += L", ";
       
    88 	description += iDescription;
       
    89 	return (description.c_str ()); 
       
    90 	}
       
    91 
       
    92 
       
    93 const char* CSISException::what() const throw()
       
    94 	{
       
    95 	return wstring2string (widewhat ()).c_str ();
       
    96 	}