OpenKnowledgeMaps / Headstart

A framework for creating web-based knowledge maps
https://openknowledgemaps.org/
MIT License
197 stars 42 forks source link

OpenAire searches don't fail gracefully with no results #203

Closed tarrow closed 6 years ago

tarrow commented 6 years ago

If there are no results for an OpenAire search, for example, putting in a project ID that doesn't exist or requesting a project ID that doesn't have an fp7 funder then it doesn't fail gracefully. It leaves messages in the apache/php logs like:

headstart-backend     | Error in matrix(nrow = nrow(pubs_md)) : non-numeric matrix extent
headstart-backend     | Calls: get_papers -> build_pubs_metadata -> data.frame -> matrix
headstart-backend     | Execution halted

After a call like:

http --timeout 600 -f http://localhost:9001/server/services/searchOpenAire.php q=NOTAPROJECTID project_id=26487999999999 funding_level=fp7
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: Keep-Alive
Content-Length: 18
Content-Type: application/json
Date: Thu, 15 Mar 2018 11:03:40 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.10 (Debian)
X-Powered-By: PHP/7.0.15

{
    "status": "error"
}
chreman commented 6 years ago

in the latest PR I tried to improve the error handling: https://github.com/OpenKnowledgeMaps/Headstart/pull/205/files @tarrow Do you have any expectations from the frontend for a better failure handling? e.g. a specific return value? Right now I could return a NULL value, but we don't have anything in place in the rest of the pipeline between the getpapers_step and the vis_layout step that deals with such a return, if we want to we would need to reenact the changes for the tests and text_similarity. currently the only thing that is done better is an error print.

chreman commented 6 years ago

@tarrow is this still an issue?