ncbo / bioportal_web_ui

A Rails application for biological ontologies
http://bioportal.bioontology.org/
Other
21 stars 2 forks source link

Refactor: Handle response errors status #240

Closed syphax-bouazzouni closed 1 year ago

syphax-bouazzouni commented 1 year ago

Context

Before https://github.com/ncbo/ontologies_api_ruby_client/pull/13, the HTTP requests (update or create) return nil(ruby null) if successful and the response body if error.

After merging https://github.com/ncbo/ontologies_api_ruby_client/pull/13, now all the HTTP would return a response, success, or error.

Issue

the old way of testing if the response is a success (response.nil?) will no more work because we don't return nil if success

Solution

Now the code will test the response status to know if it is a success or not

Changes

syphax-bouazzouni commented 1 year ago

Hi, @jvendetti Thanks for the time that you took for the reviews (and sorry for the troubles behind it) I fixed the issue that you mentioned (see screenshot bellow) image image

syphax-bouazzouni commented 1 year ago

My original goal is to reuse the error messages sent by the backend. In the case of Bioportal submission, there are only 2 possible errors: missing contact and upload files.

But in Agroportal we have many more fields in that form to test their validity. So it is necessary to reuse the backed errors message and not rewrite them in the front. Something like below image