| 1 | #$Id: MobyExceptionCodes.pm ,v 1.1 | ||
| 2 | # Created: 26-01-2006 | ||
| 3 | # Updated: 26-01-2006 | ||
| 4 | |||
| 5 | # Name of the package | ||
| 6 | package MOBY::Client::Exception::MobyExceptionCodes; | ||
| 7 | |||
| 8 | use vars qw /$VERSION/; | ||
| 9 | $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /: (\d+)\.(\d+)/; | ||
| 10 | |||
| 11 | use strict; | ||
| 12 | |||
| 13 | ############## | ||
| 14 | # PROTOTYPES # | ||
| 15 | ############## | ||
| 16 | sub getExceptionCodeDescription($); | ||
| 17 | |||
| 18 | |||
| 19 | ########################################################### | ||
| 20 | # An exception code is received by giving input and then, # | ||
| 21 | # the method retrieves itself exception description. # | ||
| 22 | ########################################################### | ||
| 23 | sub getExceptionCodeDescription($) { | ||
| 24 | |||
| 25 | my ($exceptionCode) = @_; | ||
| 26 | my ($INB_Exception) = {code => '', message => ''}; | ||
| 27 | |||
| 28 | switch: { | ||
| 29 | |||
| 30 | # ERROR CODES DEALING WITH ANALYSIS DATA | ||
| 31 | if ($exceptionCode == 200) { # UNKNOWN NAME: [200] "Setting input data under a non-existing name, or asking for a result using an unknown name" | ||
| 32 | |||
| 33 | $INB_Exception->{code} = $exceptionCode; | ||
| 34 | $INB_Exception->{message} = "Setting input data under a non-existing name, or asking for a result using an unknown name."; | ||
| 35 | |||
| 36 | } elsif ($exceptionCode == 201) { # INPUTS INVALID: [201] "Input data are invalid; not match with its definitions, or with its dependency condition" | ||
| 37 | |||
| 38 | $INB_Exception->{code} = $exceptionCode; | ||
| 39 | $INB_Exception->{message} = "Input data are invalid; not match with its definitions, or with its dependency condition."; | ||
| 40 | |||
| 41 | } elsif ($exceptionCode == 202) { # INPUT NOT ACCEPTED: [202] "Input data are not accepted" | ||
| 42 | |||
| 43 | ($INB_Exception) = { | ||
| 44 | 'code' => $exceptionCode, | ||
| 45 | 'message' => "Input data are not accepted.", | ||
| 46 | }; | ||
| 47 | |||
| 48 | } elsif ($exceptionCode == 221) { # INPUT REQUIRED PARAMETER: [221] "Service require parameter X" | ||
| 49 | |||
| 50 | ($INB_Exception) = { | ||
| 51 | 'code' => $exceptionCode, | ||
| 52 | 'message' => "Service require parameter.", | ||
| 53 | }; | ||
| 54 | |||
| 55 | } elsif ($exceptionCode == 222) { # INPUT INCORRECT PARAMETER: [222] "Incorrect parameter X" | ||
| 56 | |||
| 57 | ($INB_Exception) = { | ||
| 58 | 'code' => $exceptionCode, | ||
| 59 | 'message' => "Incorrect parameter.", | ||
| 60 | }; | ||
| 61 | |||
| 62 | } elsif ($exceptionCode == 223) { # INPUT INCORRECT SIMPLE: [223] "Incorrect input in simple article" | ||
| 63 | |||
| 64 | ($INB_Exception) = { | ||
| 65 | 'code' => $exceptionCode, | ||
| 66 | 'message' => "Incorrect input in simple article.", | ||
| 67 | }; | ||
| 68 | |||
| 69 | } elsif ($exceptionCode == 224) { # INPUT INCORRECT SIMPLENB: [224] "Service requires two or more simple articles" | ||
| 70 | |||
| 71 | ($INB_Exception) = { | ||
| 72 | 'code' => $exceptionCode, | ||
| 73 | 'message' => "Service requires two or more simple articles.", | ||
| 74 | }; | ||
| 75 | |||
| 76 | } elsif ($exceptionCode == 225) { # INPUT INCORRECT COLLECTION: [225] "Incorrect input in collection article" | ||
| 77 | |||
| 78 | ($INB_Exception) = { | ||
| 79 | 'code' => $exceptionCode, | ||
| 80 | 'message' => "Incorrect input in collection article.", | ||
| 81 | }; | ||
| 82 | |||
| 83 | } elsif ($exceptionCode == 226) { # INPUT EMPTY OBJECT: [226] "Empty input object" | ||
| 84 | |||
| 85 | ($INB_Exception) = { | ||
| 86 | 'code' => $exceptionCode, | ||
| 87 | 'message' => "Empty input object.", | ||
| 88 | }; | ||
| 89 | |||
| 90 | } elsif ($exceptionCode == 231) { # INPUT EMPTY MOBYCONTENT: [231] "Empty MOBYContent" | ||
| 91 | |||
| 92 | ($INB_Exception) = { | ||
| 93 | 'code' => $exceptionCode, | ||
| 94 | 'message' => "Empty MOBYContent.", | ||
| 95 | }; | ||
| 96 | |||
| 97 | } elsif ($exceptionCode == 232) { # INPUT EMPTY MOBYCONTENT: [232] "QueryID does not exists" | ||
| 98 | |||
| 99 | ($INB_Exception) = { | ||
| 100 | 'code' => $exceptionCode, | ||
| 101 | 'message' => "QueryID does not exists.", | ||
| 102 | }; | ||
| 103 | |||
| 104 | } elsif ($exceptionCode == 233) { # INPUT EMPTY MOBYDATA: [233] "Empty MOBYData" | ||
| 105 | |||
| 106 | ($INB_Exception) = { | ||
| 107 | 'code' => $exceptionCode, | ||
| 108 | 'message' => "Empty MOBYData.", | ||
| 109 | }; | ||
| 110 | |||
| 111 | # EXCEPTION CODES DEALING WITH ANALYSIS EXECUTION | ||
| 112 | } elsif ($exceptionCode == 300) { # NOT RUNNABLE: [300] "The same job has already been executed, or the data that had been set previously do not exist or are not accessible anymore" | ||
| 113 | |||
| 114 | ($INB_Exception) = { | ||
| 115 | 'code' => $exceptionCode, | ||
| 116 | 'message' => "The same job has already been executed, or the data that had been set previously do not exist or are not accessible anymore.", | ||
| 117 | }; | ||
| 118 | |||
| 119 | } elsif ($exceptionCode == 301) { # NOT RUNNING: [301] "A job has not yet been started" | ||
| 120 | |||
| 121 | ($INB_Exception) = { | ||
| 122 | 'code' => $exceptionCode, | ||
| 123 | 'message' => "The job has not yet been started.", | ||
| 124 | }; | ||
| 125 | |||
| 126 | } elsif ($exceptionCode == 302) { # NOT TERMINATED: [302] "A job is not interruptible for some reason" | ||
| 127 | |||
| 128 | ($INB_Exception) = { | ||
| 129 | 'code' => $exceptionCode, | ||
| 130 | 'message' => "The job is not interruptible for some reason.", | ||
| 131 | }; | ||
| 132 | |||
| 133 | # EXCEPTION CODES DEALING WITH ANALYSIS EXECUTION | ||
| 134 | } elsif ($exceptionCode == 400) { # NO METADATA AVAILABLE: [400] "There are no metadata available" | ||
| 135 | |||
| 136 | ($INB_Exception) = { | ||
| 137 | 'code' => $exceptionCode, | ||
| 138 | 'message' => "There are no metadata available.", | ||
| 139 | }; | ||
| 140 | |||
| 141 | # EXCEPTION CODES DEALING WITH NOTIFICATION | ||
| 142 | } elsif ($exceptionCode == 500) { # PROTOCOLS UNACCEPTED: [500] "Server does not agree on using any of the proposed notification protocols" | ||
| 143 | |||
| 144 | ($INB_Exception) = { | ||
| 145 | 'code' => $exceptionCode, | ||
| 146 | 'message' => "Server does not agree on using any of the proposed notification protocols.", | ||
| 147 | }; | ||
| 148 | |||
| 149 | # GENERAL EXCEPTION CODES | ||
| 150 | } elsif ($exceptionCode == 600) { # INTERNAL PROCESSING ERROR: [600] "A generic error during internal processing" | ||
| 151 | |||
| 152 | ($INB_Exception) = { | ||
| 153 | 'code' => $exceptionCode, | ||
| 154 | 'message' => "A generic error during internal processing.", | ||
| 155 | }; | ||
| 156 | |||
| 157 | } elsif ($exceptionCode == 601) { # COMMUNICATION FAILURE: [601] "A generic network failure" | ||
| 158 | |||
| 159 | ($INB_Exception) = { | ||
| 160 | 'code' => $exceptionCode, | ||
| 161 | 'message' => "A generic network failure.", | ||
| 162 | }; | ||
| 163 | |||
| 164 | } elsif ($exceptionCode == 602) { # UNKNOWN STATE: [602] "Used when a network call expects to find an existing state but failed" | ||
| 165 | |||
| 166 | ($INB_Exception) = { | ||
| 167 | 'code' => $exceptionCode, | ||
| 168 | 'message' => "Unknown State.", | ||
| 169 | }; | ||
| 170 | |||
| 171 | } elsif ($exceptionCode == 603) { # NOT IMPLEMENTED: [603] "Not implemented method in question" | ||
| 172 | |||
| 173 | ($INB_Exception) = { | ||
| 174 | 'code' => $exceptionCode, | ||
| 175 | 'message' => "Not implemented method in question.", | ||
| 176 | }; | ||
| 177 | |||
| 178 | # NUEVO------------------------------------------------------ | ||
| 179 | # NUEVO------------------------------------------------------ | ||
| 180 | } elsif ($exceptionCode == 621) { # SERIVCE NOT AVAILABLE: [621] "Service not available" | ||
| 181 | |||
| 182 | ($INB_Exception) = { | ||
| 183 | 'code' => $exceptionCode, | ||
| 184 | 'message' => "Service not available.", | ||
| 185 | }; | ||
| 186 | |||
| 187 | # NUEVO------------------------------------------------------ | ||
| 188 | # NUEVO------------------------------------------------------ | ||
| 189 | } elsif ($exceptionCode == 700) { # OK: [700] "Everything was ok" | ||
| 190 | |||
| 191 | ($INB_Exception) = { | ||
| 192 | 'code' => $exceptionCode, | ||
| 193 | 'message' => "Everything was ok.", | ||
| 194 | }; | ||
| 195 | |||
| 196 | # SERVICE INTRISIC ERRORS | ||
| 197 | } elsif ($exceptionCode == 701) { # SERVICE INTERNAL ERROR: [701] "Specific errors from the BioMOBY service" | ||
| 198 | |||
| 199 | ($INB_Exception) = { | ||
| 200 | 'code' => $exceptionCode, | ||
| 201 | 'message' => "Specific errors from the BioMOBY service.", | ||
| 202 | }; | ||
| 203 | |||
| 204 | } elsif ($exceptionCode == 702) { # OBJECT NOT FOUND: [702] "Object not found with the given input" | ||
| 205 | |||
| 206 | ($INB_Exception) = { | ||
| 207 | 'code' => $exceptionCode, | ||
| 208 | 'message' => "Object not found with the given input.", | ||
| 209 | }; | ||
| 210 | |||
| 211 | } elsif ($exceptionCode == 703) { # DATA_NOT_LONGER_VALID: [703] "A sequence indentifier that has been retracted" | ||
| 212 | |||
| 213 | ($INB_Exception) = { | ||
| 214 | 'code' => $exceptionCode, | ||
| 215 | 'message' => "A sequence indentifier that has been retracted.", | ||
| 216 | }; | ||
| 217 | } elsif ($exceptionCode == 704) { # INPUT_BIOLOGICALLY_INVALID: [704] "The input does not make sense biologically" | ||
| 218 | |||
| 219 | ($INB_Exception) = { | ||
| 220 | 'code' => $exceptionCode, | ||
| 221 | 'message' => "The input does not make sense biologically.", | ||
| 222 | }; | ||
| 223 | } elsif ($exceptionCode == 705) { # DATA_TRANSFORMED: [705] "The input data is transformed" | ||
| 224 | |||
| 225 | ($INB_Exception) = { | ||
| 226 | 'code' => $exceptionCode, | ||
| 227 | 'message' => "The input data is transformed.", | ||
| 228 | }; | ||
| 229 | |||
| 230 | # NUEVO------------------------------------------------------ | ||
| 231 | # NUEVO------------------------------------------------------ | ||
| 232 | |||
| 233 | } elsif ($exceptionCode == 721) { # INCORRECT ARTICLE NAME: [721] "The specified name of MOBYData article is wrong or does not exist" | ||
| 234 | |||
| 235 | ($INB_Exception) = { | ||
| 236 | 'code' => $exceptionCode, | ||
| 237 | 'message' => "The specified name of MOBYData article is wrong or does not exist.", | ||
| 238 | }; | ||
| 239 | |||
| 240 | } elsif ($exceptionCode == 722) { # INCORRECT OBJECT TYPE: [722] "Incorrect Object type from specified MOBYData article" | ||
| 241 | |||
| 242 | ($INB_Exception) = { | ||
| 243 | 'code' => $exceptionCode, | ||
| 244 | 'message' => "Incorrect Object type from specified MOBYData article.", | ||
| 245 | }; | ||
| 246 | |||
| 247 | } elsif ($exceptionCode == 723) { # INCORRECT ARTICLENAME OBJECT: [723] "The specified article name of BioMOBY Object is wrong or does not exist" | ||
| 248 | |||
| 249 | ($INB_Exception) = { | ||
| 250 | 'code' => $exceptionCode, | ||
| 251 | 'message' => "The specified article name of BioMOBY Object is wrong or does not exist.", | ||
| 252 | }; | ||
| 253 | |||
| 254 | } elsif ($exceptionCode == 724) { # INCORRECT NAMESPACE OBJECT: [724] "The namespace of specified BioMOBY Object is invalid" | ||
| 255 | |||
| 256 | ($INB_Exception) = { | ||
| 257 | 'code' => $exceptionCode, | ||
| 258 | 'message' => "The namespace of specified BioMOBY Object is invalid.", | ||
| 259 | }; | ||
| 260 | |||
| 261 | } elsif ($exceptionCode == 731) { # INCORRECT ARTICLENAME OF SECONDARY: [731] "The specified name of secondary is wrong or does not exist" | ||
| 262 | |||
| 263 | ($INB_Exception) = { | ||
| 264 | 'code' => $exceptionCode, | ||
| 265 | 'message' => "The specified name of secondary is wrong or does not exist.", | ||
| 266 | }; | ||
| 267 | |||
| 268 | } elsif ($exceptionCode == 732) { # INCORRECT DATA TYPE OF SECONDARY: [732] "Incorrect data type from specified secondary article" | ||
| 269 | |||
| 270 | ($INB_Exception) = { | ||
| 271 | 'code' => $exceptionCode, | ||
| 272 | 'message' => "Incorrect data type from specified secondary article.", | ||
| 273 | }; | ||
| 274 | |||
| 275 | } elsif ($exceptionCode == 733) { # INCORRECT VALUE FROM SECONDARY: [733] "The value of secondary article is invalid. It is not inside of correct range" | ||
| 276 | |||
| 277 | ($INB_Exception) = { | ||
| 278 | 'code' => $exceptionCode, | ||
| 279 | 'message' => "The value of secondary article is invalid. It is not inside of correct range.", | ||
| 280 | }; | ||
| 281 | |||
| 282 | } elsif ($exceptionCode == 734) { # INCORRECT VALUE AND DEFAULT VALUE FROM SECONDARY: [734] "There is not SECONDARY value and registered SECONDARY article has not default value" | ||
| 283 | |||
| 284 | ($INB_Exception) = { | ||
| 285 | 'code' => $exceptionCode, | ||
| 286 | 'message' => "There is not SECONDARY value and registered SECONDARY article has not default value.", | ||
| 287 | }; | ||
| 288 | } | ||
| 289 | # NUEVO------------------------------------------------------ | ||
| 290 | # NUEVO------------------------------------------------------ | ||
| 291 | |||
| 292 | } # End Switch | ||
| 293 | |||
| 294 | return ($INB_Exception->{message}); | ||
| 295 | |||
| 296 | } # End getExceptionCodeDescription | ||
| 297 | |||
| 298 | 1; | ||
| 299 | |||
| 300 | |||
| 301 | ############################### | ||
| 302 | # End General Purpose Package # | ||
| 303 | ############################### | ||
| 304 | |||
| 305 | __END__ |