|
1 /* |
|
2 * Copyright (c) 2005-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: |
|
15 * UCCS_ErrorCodes.cpp -- provides a function that translates error codes into |
|
16 * a string description. |
|
17 * System Includes |
|
18 * Local Includes |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 #include "UCCS_ErrorCodes.h" |
|
25 #include "../../include/penstd.h" |
|
26 |
|
27 |
|
28 /******************************************************************************** |
|
29 * |
|
30 * GetPenstdErrorString() |
|
31 * |
|
32 ********************************************************************************/ |
|
33 char *GetPenstdErrorString( int aErrorCode ) |
|
34 |
|
35 { |
|
36 switch( aErrorCode ) { |
|
37 case ERR_NONE: |
|
38 return "success"; |
|
39 case ERR_INVALID_ERROR_CODE: |
|
40 return "THIS IS AN INVALID ERROR CODE"; |
|
41 case ERR_MISSING_PARAMETER: |
|
42 return "there is a missing parameter"; |
|
43 case ERR_SERVICE_ALREADY_STARTED: |
|
44 return "service already started"; |
|
45 case ERR_SERVICE_NOT_RUNNING: |
|
46 return "service not running"; |
|
47 case ERR_ACTIVE_USER_SESSIONS: |
|
48 return "active user sessions exist"; |
|
49 case ERR_FAILED_TO_REMOVE_ACTIVE_SESSIONS: |
|
50 return "failed to remove active user sessions"; |
|
51 case ERR_FAILED_TO_CREATE_COMPONENT_MANAGER: |
|
52 return "failed to create the component manager"; |
|
53 case ERR_FAILED_TO_RETRIEVE_KEY: |
|
54 return "failed to retrieve the instance key from the arguments"; |
|
55 case ERR_INSTANCE_DOES_NOT_EXIST: |
|
56 return "instance does not exist"; |
|
57 case ERR_INVALID_METHOD: |
|
58 return "invalid method"; |
|
59 case ERR_CANNOT_CREATE_NEW_INSTANCE: |
|
60 return "can't create a new instance"; |
|
61 case ERR_STUB_ALREADY_CONNECTED: |
|
62 return "stub already connected to the service"; |
|
63 case ERR_FAILED_TO_CONNECT: |
|
64 return "failed to connect to the service"; |
|
65 case ERR_STUB_NOT_CONNECTED: |
|
66 return "stub not connected to a service"; |
|
67 case ERR_INVALID_RV_POINTER: |
|
68 return "invalid rv pointer"; |
|
69 case ERR_RPC_ERROR: |
|
70 return "rpc error"; |
|
71 case ERR_INVALID_SERVICE: |
|
72 return "invalid service"; |
|
73 case ERR_INVALIDARG: |
|
74 return "invalid argument"; |
|
75 case ERR_INVALIDSTATE: |
|
76 return "invalid state"; |
|
77 case ERR_GENERAL: |
|
78 return "general error"; |
|
79 case ERR_INVALID_CALL: |
|
80 return "invalid call"; |
|
81 default: |
|
82 return "(unknown error)"; |
|
83 } |
|
84 return "(unknown error)"; |
|
85 } |
|
86 |
|
87 |
|
88 /******************************************************************************** |
|
89 * |
|
90 * GetUccsErrorString() |
|
91 * |
|
92 ********************************************************************************/ |
|
93 char *GetUccsErrorString( TUCCSErrors aErrorCode ) |
|
94 { |
|
95 switch( aErrorCode ) { |
|
96 |
|
97 // Script and BatchEngine Errors |
|
98 case UCCS_OK: |
|
99 return "Success"; |
|
100 case UCCS_SERVICELISTFULL: |
|
101 return "The maximum number of services have already been started"; |
|
102 case UCCS_NO_MATCHING_GENERIC_SERVICE_FOUND: |
|
103 return "No matching generic service found. Please check spelling against service defined in ucc.ini"; |
|
104 case UCCS_NOSERVICEID: |
|
105 return "The command must specify the target service (SVCID)"; |
|
106 case UCCS_INVALIDSERVICEID: |
|
107 return "The specified target service (SVCID) is invalid"; |
|
108 case UCCS_CANTSTARTSERVICE: |
|
109 return "Failed to connect to the service"; |
|
110 case UCCS_CANTSTOPSERVICE: |
|
111 return "Failed to stop the service"; |
|
112 case UCCS_NOSERVICEHOST: |
|
113 return "The command must specify the hostname of the target service (SVCHOST)"; |
|
114 case UCCS_INVALIDSERVICEINDEX: |
|
115 return "INTERNAL_ERROR_CODE: UCCS_INVALIDSERVICEINDEX"; |
|
116 case UCCS_PARSERFAILEDTOSTOREVALUE: |
|
117 return "An error occured while parsing the script command"; |
|
118 case UCCS_UNKNOWNCOMMAND: |
|
119 return "This is not a known command"; |
|
120 case UCCS_REPLAYCOMMAND: |
|
121 return "INTERNAL_ERROR_CODE: UCCS_REPLAYCOMMAND"; |
|
122 case UCCS_NORESULT: |
|
123 return "No commands (runcmd) have been completed, therefore there is no result to check/waitfor"; |
|
124 case UCCS_QUIT: |
|
125 return "INTERNAL_ERROR_CODE: UCCS_QUIT"; |
|
126 case UCCS_REQUIREDVALUEERROR: |
|
127 return "Some of the required fields do not exist"; |
|
128 case UCCS_REQUIREDVALUEINCORRECT: |
|
129 return "Some of the required field values do not match those returned"; |
|
130 case UCCS_REQUIREDNOTVALUEERROR: |
|
131 return "Some of the required (not) fields do not exist"; |
|
132 case UCCS_REQUIREDNOTVALUEMATCH: |
|
133 return "Some of the required (not) field values match those returned"; |
|
134 case UCCS_CHECKVALUEERROR: |
|
135 return "Some of the check fields do not exist"; |
|
136 case UCCS_CHECKVALUEINCORRECT: |
|
137 return "Some of the check field values do not match those returned"; |
|
138 case UCCS_CHECKNOTVALUEERROR: |
|
139 return "Some of the check (not) fields do not exist"; |
|
140 case UCCS_CHECKNOTVALUEMATCH: |
|
141 return "Some of the check (not) field values match those returned"; |
|
142 case UCCS_FIELDNOTFOUND: |
|
143 return "An expected record field was not found"; |
|
144 case UCCS_SYSTEMERROR: |
|
145 return "An system call has failed"; |
|
146 case UCCS_RECORDFULL: |
|
147 return "The record is full"; |
|
148 case UCCS_NOMORECOMMANDS: |
|
149 return "INTERNAL_ERROR: UCCS_NOMORECOMMANDS"; |
|
150 case UCCS_UNKNOWNCONTROLCOMMAND: |
|
151 return "An unknown control command was received"; |
|
152 case UCCS_CLIENT_ERROR: |
|
153 return "The client failed to execute the command"; |
|
154 |
|
155 // Control Command Errors |
|
156 case UCCS_ALREADYSTARTEDUSECASE: |
|
157 return "There is already an active use-case"; |
|
158 case UCCS_NOUSECASERUNNING: |
|
159 return "There is no use-case active"; |
|
160 case UCCS_FAILEDTOCREATEEXECUTETHREAD: |
|
161 return "SYSTEM_ERROR: The controller couldn't create a thread to execute the script"; |
|
162 case UCCS_COMMANDEXECUTIONNOTSTARTEDYET: |
|
163 return "A use-case is being initialised"; |
|
164 case UCCS_SCRIPTFINISHED: |
|
165 return "The active use-case script has completed"; |
|
166 case UCCS_CANTOPENSCRIPTFILE: |
|
167 return "Failed to open the requested use-case script file"; |
|
168 case UCCS_CANTOPENOUTPUTFILE: |
|
169 return "Failed to open the output files"; |
|
170 case UCCS_VARIABLEVALTOOLONG: |
|
171 return "The buffer supplied to GetEnvironmentVariable is too small to hold the requested value"; |
|
172 case UCCS_VARIABLEDOESNOTEXIST: |
|
173 return "The requested field does not exist in the current environment"; |
|
174 case UCCS_NOENVIRONMENT: |
|
175 return "INTERNAL_ERROR: UCCS_NOENVIRONMENT"; |
|
176 |
|
177 // Other |
|
178 case UCCS_LAST: |
|
179 return "INTERNAL_ERROR: UCCS_LAST"; |
|
180 default: |
|
181 // check for penstd error values |
|
182 // - not sure if they are intended to come through as UCCS errors, but alas they do anyway |
|
183 // eg. -17 = missing param --> re-producible by having a mismatch in paramaeter names |
|
184 return GetPenstdErrorString(aErrorCode); |
|
185 } |
|
186 } |