Project

General

Profile

« Previous | Next » 

Revision 5624

Added by berkley about 14 years ago

updated all exception codes to match spec

View differences:

src/edu/ucsb/nceas/metacat/dataone/CrudService.java
211 211
        }
212 212
        catch(Exception e)
213 213
        {
214
            throw new ServiceFailure("1000", "Error authenticating with metacat: " + e.getMessage());
214
            throw new ServiceFailure("1620", "Error authenticating with metacat: " + e.getMessage());
215 215
        }
216 216
    }
217 217
    
......
293 293
        {
294 294
            //TODO: many of the thrown exceptions do not use the correct error codes
295 295
            //check these against the docs and correct them
296
            throw new NotAuthorized("1000", "User " + username + " is not authorized to create content." +
296
            throw new NotAuthorized("1100", "User " + username + " is not authorized to create content." +
297 297
                    "  If you are not logged in, please do so and retry the request.");
298 298
        }
299 299
        
......
440 440
        }
441 441
        catch(Exception e)
442 442
        {
443
            throw new ServiceFailure("1030", "Error updating document in CrudService: " + e.getMessage());
443
            throw new ServiceFailure("1310", "Error updating document in CrudService: " + e.getMessage());
444 444
        }
445 445
    }
446 446
    
......
895 895
            throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
896 896
            NotImplemented {
897 897
        logCrud.info("delete");
898
        throw new NotImplemented("1000", "This method not yet implemented.");
898
        throw new NotImplemented("1321", "This method not yet implemented.");
899 899
    }
900 900

  
901 901
    /**
......
905 905
            throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
906 906
            NotImplemented {
907 907
        logCrud.info("describe");
908
        throw new NotImplemented("1000", "This method not yet implemented.");
908
        throw new NotImplemented("1361", "This method not yet implemented.");
909 909
    }
910 910
    
911 911
    /**
......
1030 1030
        }
1031 1031
        catch(Exception e)
1032 1032
        {
1033
            throw new ServiceFailure("1000", "Error getting checksum: " + e.getMessage());
1033
            throw new ServiceFailure("1410", "Error getting checksum: " + e.getMessage());
1034 1034
        }
1035 1035
        Checksum c = new Checksum();
1036 1036
        c.setAlgorithm(ChecksumAlgorithm.convert(checksumAlgorithm));
......
1221 1221
                                groupnames, true, params);
1222 1222
                    } catch (PropertyNotFoundException e) {
1223 1223
                        e.printStackTrace();
1224
                        throw new ServiceFailure("1030", "Property not found while reading system metadata from metacat: " + e.getMessage());
1224
                        throw new ServiceFailure("1090", "Property not found while reading system metadata from metacat: " + e.getMessage());
1225 1225
                    } catch (ClassNotFoundException e) {
1226 1226
                        e.printStackTrace();
1227
                        throw new ServiceFailure("1030", "Class not found while reading system metadata from metacat: " + e.getMessage());
1227
                        throw new ServiceFailure("1090", "Class not found while reading system metadata from metacat: " + e.getMessage());
1228 1228
                    } catch (IOException e) {
1229 1229
                        e.printStackTrace();
1230
                        throw new ServiceFailure("1030", "IOException while reading system metadata from metacat: " + e.getMessage());
1230
                        throw new ServiceFailure("1090", "IOException while reading system metadata from metacat: " + e.getMessage());
1231 1231
                    } catch (SQLException e) {
1232 1232
                        e.printStackTrace();
1233
                        throw new ServiceFailure("1030", "SQLException while reading system metadata from metacat: " + e.getMessage());
1233
                        throw new ServiceFailure("1090", "SQLException while reading system metadata from metacat: " + e.getMessage());
1234 1234
                    } catch (McdbException e) {
1235 1235
                        e.printStackTrace();
1236
                        throw new ServiceFailure("1030", "Metacat DB Exception while reading system metadata from metacat: " + e.getMessage());
1236
                        throw new ServiceFailure("1090", "Metacat DB Exception while reading system metadata from metacat: " + e.getMessage());
1237 1237
                    } catch (ParseLSIDException e) {
1238 1238
                        e.printStackTrace();
1239
                        throw new NotFound("1020", "Error parsing LSID while reading system metadata from metacat: " + e.getMessage());
1239
                        throw new NotFound("1060", "Error parsing LSID while reading system metadata from metacat: " + e.getMessage());
1240 1240
                    } catch (InsufficientKarmaException e) {
1241 1241
                        e.printStackTrace();
1242
                        throw new NotAuthorized("1000", "User not authorized for get() on system metadata: " + e.getMessage());
1242
                        throw new NotAuthorized("1040", "User not authorized for get() on system metadata: " + e.getMessage());
1243 1243
                    }
1244 1244

  
1245 1245
                    return "Completed";
......
1261 1261
            
1262 1262
        } catch (McdbDocNotFoundException e) {
1263 1263
            //e.printStackTrace();
1264
            throw new NotFound("1000", e.getMessage());
1264
            throw new NotFound("1040", e.getMessage());
1265 1265
        }                
1266 1266
    }
1267 1267
    

Also available in: Unified diff