Commit 51407c65 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

return db_data if source not found

parent dff4e9c0
......@@ -22,7 +22,12 @@ class FunctionViewSet(BulkViewSet):
def _get_external_info(self, db_data):
detailed_info_retriever = GetFunctionExternalInfo(db_data['function_id'],
db_data['source'])
detailed_data = detailed_info_retriever.get_details() # @TODO check consistency?
try:
detailed_data = detailed_info_retriever.get_details()
except NotImplementedError as not_implemented_error:
logger.warning("Could not found API for the source, returning item from the DB. Error: %s" %
not_implemented_error)
detailed_data = db_data
return detailed_data
def retrieve(self, request, *args, **kwargs):
......
......@@ -15,8 +15,7 @@ class GetFunctionExternalInfo:
self.source = source
def _get_unknown_source(self):
logger.warning("No source of information for %s from %s" % (self.function_id, self.source))
raise NotImplementedError
raise NotImplementedError("No source of information for %s from %s" % (self.function_id, self.source))
def _get_kegg(self):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment