|
1 /* |
|
2 * Copyright (c) 1995-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 #include "cache/cacheexception.hpp" |
|
19 |
|
20 |
|
21 int CacheException::EPOCROOT_NOT_FOUND = 1; |
|
22 int CacheException::RESOURCE_ALLOCATION_FAILURE = 2; |
|
23 int CacheException::CACHE_NOT_FOUND = 3; |
|
24 int CacheException::CACHE_INVALID = 4; |
|
25 int CacheException::CACHE_IS_EMPTY = 5; |
|
26 int CacheException::HARDDRIVE_FAILURE = 6; |
|
27 |
|
28 |
|
29 CacheException::CacheException(int ErrorCode) |
|
30 { |
|
31 this->errcode = ErrorCode; |
|
32 |
|
33 return; |
|
34 } |
|
35 |
|
36 |
|
37 int CacheException::GetErrorCode(void) |
|
38 { |
|
39 return this->errcode; |
|
40 } |
|
41 |
|
42 |
|
43 const char* CacheException::GetErrorMessage(void) |
|
44 { |
|
45 if(this->errcode == CacheException::EPOCROOT_NOT_FOUND) |
|
46 return "EPOCROOT environment variable is not set."; |
|
47 else if(this->errcode == CacheException::RESOURCE_ALLOCATION_FAILURE) |
|
48 return "Not enough system resources to initialize cache module."; |
|
49 else if(this->errcode == CacheException::CACHE_NOT_FOUND) |
|
50 return "Cache is not present in the current system."; |
|
51 else if(this->errcode == CacheException::CACHE_INVALID) |
|
52 return "Cache is invalid."; |
|
53 else if(this->errcode == CacheException::CACHE_IS_EMPTY) |
|
54 return "Cache is empty."; |
|
55 else if(this->errcode == CacheException::HARDDRIVE_FAILURE) |
|
56 return "A hard drive failure occurred in Cache operations."; |
|
57 |
|
58 return "Undefined error type."; |
|
59 } |
|
60 |
|
61 |
|
62 CacheException::~CacheException(void) |
|
63 { |
|
64 return; |
|
65 } |