|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 #include "epocerror.h" |
|
22 |
|
23 |
|
24 GLDEF_C TBool |
|
25 EpocError::Evaluate(TInt err) |
|
26 /** |
|
27 Check the return value for an error and set the global error values |
|
28 on error |
|
29 |
|
30 @param err Error code |
|
31 @return ETrue if successful or EFalse |
|
32 */ |
|
33 { |
|
34 TInt valid = ETrue; |
|
35 |
|
36 if (err == KErrNone) |
|
37 { |
|
38 static TPtrC x = _L(""); |
|
39 iLastError = KErrNone; |
|
40 LastErrorMessage.Set(x); |
|
41 } |
|
42 else |
|
43 { |
|
44 static TPtrC x[] = { |
|
45 _L("Unable to find the specified object or missing required field values"), |
|
46 _L("General (unspecified) error"), |
|
47 _L("The operation was cancelled"), |
|
48 _L("Not enough memory. Close some applications and try again"), |
|
49 _L("The operation requested is not supported"), |
|
50 _L("Bad argument supplied"), |
|
51 _L("Total loss of precision"), |
|
52 _L("Bad object"), |
|
53 _L("Overflow"), |
|
54 _L("Underflow"), |
|
55 _L("Object already exists"), |
|
56 _L("Unable to find the specified folder"), |
|
57 _L("Closed"), |
|
58 _L("The specified object is currently in use by another program"), |
|
59 _L("Server has closed"), |
|
60 _L("Server is busy"), |
|
61 _L("Completion error"), |
|
62 _L("Not ready"), |
|
63 _L("Unknown error"), |
|
64 _L("Corrupt"), |
|
65 _L("Access denied"), |
|
66 _L("Locked"), |
|
67 _L("Failed to write"), |
|
68 _L("Wrong disk present"), |
|
69 _L("Unexpected end of file"), |
|
70 _L("Disk full"), |
|
71 _L("Bad device driver"), |
|
72 _L("Bad name"), |
|
73 _L("Comms line failed"), |
|
74 _L("Comms frame error"), |
|
75 _L("Comms overrun error"), |
|
76 _L("Comms parity error"), |
|
77 _L("Timed out"), |
|
78 _L("Failed to connect"), |
|
79 _L("Failed to disconnect"), |
|
80 _L("Disconnected"), |
|
81 _L("Bad library entry point"), |
|
82 _L("Bad descriptor"), |
|
83 _L("Interrupted"), |
|
84 _L("Too big"), |
|
85 _L("Divide by zero"), |
|
86 _L("Batteries too low"), |
|
87 _L("Folder full"), |
|
88 _L("Hardware is not available") |
|
89 }; |
|
90 |
|
91 // loop through the general error codes |
|
92 TInt i = -1; |
|
93 TInt j = 0; |
|
94 for (i=-1, j=0;i > -45;i--, j++) |
|
95 { |
|
96 if (err == i) |
|
97 { |
|
98 iLastError = err; |
|
99 LastErrorMessage.Set(x[j]); |
|
100 valid = EFalse; |
|
101 break; |
|
102 } |
|
103 } |
|
104 |
|
105 // error not found |
|
106 if (valid) |
|
107 { |
|
108 iLastError = err; |
|
109 LastErrorMessage.Set(_L("Unspecified error occurred")); |
|
110 valid = EFalse; |
|
111 } |
|
112 } |
|
113 |
|
114 return valid; |
|
115 } |
|
116 |