javacommons/javastorage/inc/javastorageexception.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008-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 "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:  JavaStorageException
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef JAVASTORAGEEXCEPTION_H
       
    20 #define JAVASTORAGEEXCEPTION_H
       
    21 
       
    22 #include "exceptionbase.h"
       
    23 #include "javaosheaders.h"
       
    24 
       
    25 namespace java
       
    26 {
       
    27 namespace storage
       
    28 {
       
    29 
       
    30 /**
       
    31  * JavaStorage specific JavaStorageException. It is used to indicate
       
    32  * JavaStorage related errors.
       
    33  */
       
    34 class JavaStorageException : public java::util::ExceptionBase
       
    35 {
       
    36 public:
       
    37     JavaStorageException(int aStatus,
       
    38                          const std::string& aMessage,
       
    39                          const std::string& aFile,
       
    40                          const std::string& aMethod,
       
    41                          int aLine)
       
    42     throw() : ExceptionBase(aMessage,
       
    43                                     aFile,
       
    44                                     aMethod,
       
    45                                     aLine), mStatus(aStatus) {}
       
    46 
       
    47     virtual ~JavaStorageException() throw() {}
       
    48 
       
    49     /**
       
    50      * Convert exception to string.
       
    51      *
       
    52      * @return exception as string.
       
    53      */
       
    54     OS_IMPORT std::string toString() const throw();
       
    55 
       
    56     JavaStorageException(const JavaStorageException& x) : ExceptionBase(x)
       
    57     {
       
    58         mStatus = x.mStatus;
       
    59     }
       
    60     int    mStatus;
       
    61 
       
    62 private:
       
    63     // Not implemented.
       
    64     JavaStorageException& operator= (const JavaStorageException&);
       
    65 };
       
    66 
       
    67 enum StorageErrorCodes
       
    68 {
       
    69     ECommsFailure = -100,
       
    70     EInvalidStorage,
       
    71     EInvalidConnection,
       
    72     EInternalError,
       
    73     EInvalidDataStructure,
       
    74     EGeneralFailure,
       
    75     EInvalidArgument
       
    76 };
       
    77 
       
    78 
       
    79 } // end namespace storage
       
    80 } // end namespace java
       
    81 
       
    82 #endif // JAVASTORAGEEXCEPTION_H