Skip to content

Commit

Permalink
Merge pull request #25 from usnistgov/fix/ODD-670_Error_Message_with_…
Browse files Browse the repository at this point in the history
…HTML_Error_codes

404 error when non-existent record id is requested via record/id resource.
  • Loading branch information
RayPlante authored Oct 17, 2018
2 parents 49be82e + 1e21c20 commit 56b3e52
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.mongodb.client.model.Filters;

import gov.nist.oar.rmm.config.MongoConfig;
import gov.nist.oar.rmm.exceptions.ResourceNotFoundException;
import gov.nist.oar.rmm.repositories.CustomRepository;
import gov.nist.oar.rmm.utilities.ProcessRequest;

Expand Down Expand Up @@ -113,7 +114,8 @@ public Document findRecord(String ediid) {

long count = mcollection.count(Filters.eq("ediid",ediid));
if(count == 0) {
return new Document("Message", "No record available for given id.");
//return new Document("Message", "No record available for given id.");
throw new ResourceNotFoundException("No record available for given id.");
}
else
return mcollection.find(Filters.eq("ediid",ediid)).first();
Expand Down

0 comments on commit 56b3e52

Please sign in to comment.