kids-first / kf-persona

kids-first persona implementation
Apache License 2.0
0 stars 0 forks source link

Send a better response when an error occurred #53

Open evans-g-crsj opened 4 years ago

evans-g-crsj commented 4 years ago

An error 504 (Timeout) is received when a bad request (at least the following one) is made.

When the profile is updated but one of it's field is invalid a timeout occurs. For instance,

if profile = {...roles: ['researcher'], ...} is written like this profile = {...role: 'researcher', ...} then a 504 is received.

steps to reproduce ///////////////////////////////// Endpoint: https://kf-persona-api-qa.kidsfirstdrc.org/graphql ///////////////////////////////// graphql query :

mutation($record: UpdateByIdUserModelInput!) { userUpdate(record: $record) { record {

_id title firstName lastName egoId roles acceptedTerms email institutionalEmail eraCommonsID department story bio jobTitle institution addressLine1 addressLine2 city state country zip phone website googleScholarId twitter facebook github linkedin orchid interests acceptedKfOptIn acceptedNihOptIn acceptedDatasetSubscriptionKfOptIn isPublic sets { name size type setId } } } } ///////////////////////////////// variables : {"variables":{"record":{"_id":"5d5d9905b70d02001a173fb8","title":"dr","firstName":"Evans","lastName":"Girard","egoId":"64da5ffa-871e-4f2f-bee9-6d2508ae9786","roles":["research"],"acceptedTerms":true,"email":"eg.crsj@gmail.com","institutionalEmail":"test@test.com","eraCommonsID":"","department":"department","story":"","bio":"Here's a test for my bio ","jobTitle":"A very good role","institution":"this is an institution","addressLine1":"1425 309 rue DesCypres","addressLine2":"address 2","city":"Trrr","state":"Qc","country":"Canada","zip":"11111111111","phone":"","website":"https://www.mysite.com","googleScholarId":"","twitter":"www.twitter/test.com","facebook":"https://www.facebook/test.com","github":"www.github/test.com","linkedin":"https://www.linkedin/test.com","orchid":"orcidid3784738437","interests":["ewing sarcoma: genetic risk","cancer","childhood cancer"],"acceptedKfOptIn":false,"acceptedNihOptIn":false,"acceptedDatasetSubscriptionKfOptIn":false,"isPublic":true,"sets":[],"role":"research"}},"query":"mutation($record: UpdateByIdUserModelInput!) {userUpdate(record: $record) {record {_idtitlefirstNamelastNameegoIdrolesacceptedTermsemailinstitutionalEmaileraCommonsIDdepartmentstorybiojobTitleinstitutionaddressLine1addressLine2citystatecountryzipphonewebsitegoogleScholarIdtwitterfacebookgithublinkedinorchidinterestsacceptedKfOptInacceptedNihOptInacceptedDatasetSubscriptionKfOptInisPublicsets {namesizetypesetId}}}}"} /////////////////////////////////

jberube commented 4 years ago

A 401 "Bad Request" should be returned in that situation : https://tools.ietf.org/html/rfc7231#section-6.5.1