Skip to content

Conversation

@gaurav
Copy link
Collaborator

@gaurav gaurav commented Jan 27, 2022

This PR adds a test for #113 -- a query containing only unresolvable curies will receive an empty response. This was happening because of two different reasons:

  1. get_info_content() would throw an exception if given an empty list of canonical IDs. I moved the function call so that it would not be called with an empty list, and additionally modified the function so that it would return an empty dictionary if somebody did call it with an empty list from elsewhere.
  2. get_normalized_nodes() would return {} if an exception was thrown inside much of the function. I've added checks to the GET and POST endpoints so that:
    1. They send an HTTP 422 Unprocessable Entity response if no CURIEs are provided.
    2. They send an HTTP 500 response if get_normalized_nodes() returns {}

This PR adds a test for queries without any resolvable CURIEs and updated the test for queries without any CURIEs at all.

Also fixes a minor typo in the README file.

@gaurav gaurav changed the title Add a test for issue #113 Fix issue #113 Jan 27, 2022
Specifically, get_info_content() expects canonical_nonan to
not be empty, and will throw an exception if it is. This change
moves it into the code that only runs if canonical_nonan is not
empty.
1. We now impose a minimum of one CURIE as input to
   /get_normalized_nodes.
2. This means that the only way in which we can get {} as a response is
   if there was an error in processing. We now report this to the user
   as an HTTP 500 error.
@gaurav gaurav marked this pull request as ready for review January 27, 2022 23:25
@gaurav gaurav requested a review from PhillipsOwen January 27, 2022 23:25
Copy link
Contributor

@PhillipsOwen PhillipsOwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raised exceptions would benefit from more context.

@PhillipsOwen PhillipsOwen merged commit d186558 into master Feb 1, 2022
@gaurav gaurav deleted the issue-113 branch February 1, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants