ideaconsult / Toxtree.js

http://ideaconsult.github.io/Toxtree.js/
2 stars 3 forks source link

Error handling in the structure search pages #166

Closed vedina closed 8 years ago

vedina commented 8 years ago

When an invalid input is specified for e.g. similarity search, the server returns an error code, but the UI appears to show the Loading compounds forever. (both search page and within assessments workflow)

https://apps.ideaconsult.net/data/ui/_search?search=50-00-0&option=similarity

It seems there is a generic problem of not checking for error codes besides 400 (not found) when filling in various tables and not updating the tables state. Please check.

gonzomir commented 8 years ago

Yes, the callbacks on various places check only for 404 status, and create empty JSON in that case. In all other cases the result is set to null and no other actions are taken.

There is onError global callback defined when the server returns status != 200 that logs to the console.

How should we handle error codes from the server? Always set the result to empty JSON so that the dataTable is rendered empty and show message to the user? In that case we should either define user-friendly messages per status code or the server should return a text message instead of generic error page.

gonzomir commented 8 years ago

Oops, the error page contains user-friendly message, but as a part of the error page. Maybe the server can return only the message as text/plain when the request is from AJAX call?

vedina commented 8 years ago

The goal is to avoid the indefinite "Loading ..." message, when in fact the request had finished. An empty table with or without error message should be fine. A generic error message would be ok. The real error message will appear in the log component anyway .

For now use the status message for GET queries.

For POST/PUT/DELETE there is an error message within the task .e.g. if the status is "Error"

{
    "task": [{
        "uri": "https://apps.ideaconsult.net/data/task/a862713b-4e9b-41eb-a0cb-53c32bed3d7c",
        "id": "a862713b-4e9b-41eb-a0cb-53c32bed3d7c",
        "name": "Apply Sleeps for 'delay' milliseconds, returns 'dataset_uri' or 'model_uri', specified on input. For testing purposes  ",
        "error": "Bad Request (400) - No result URI specified",
        "policyError": "",
        "status": "Error",
        "started": 1448717458071,
        "completed": -1,
        "result": "https://apps.ideaconsult.net/data/task/a862713b-4e9b-41eb-a0cb-53c32bed3d7c",
        "errorCause": "Bad Request (400) - No result URI specified blabla"
    }]
}
vedina commented 8 years ago

Can we get this solved this week?

gonzomir commented 8 years ago

OK, searching structures is fully handled - the message "Loading compounds" message is hidden, empty table is shown together with error message.

The main request handlers in other kits are changes to respond with empty result not only on 404 but on all non-200 statuses.