GithubHelp home page GithubHelp logo

Comments (9)

BS062721 avatar BS062721 commented on July 1, 2024

CC : @vlad-ignatov

from client-js.

BS062721 avatar BS062721 commented on July 1, 2024

@vlad-ignatov do you have any information on this?

from client-js.

vlad-ignatov avatar vlad-ignatov commented on July 1, 2024

As far as I can tell, the only reason is that this is trying to be a higher level abstraction of those requests. Instead of returning responses and response codes, it resolves with data object or rejects with error message. If your promise chain is rejected you get an error message and the "on success code" will not be executed anyway.

This seems to work well enough for everybody, unless you have some very specific way of consuming the response results. Can you specify what "returning proper error code" means in your case? Perhaps an example of what you are trying to do would help.

from client-js.

BS062721 avatar BS062721 commented on July 1, 2024

@vlad-ignatov we are consuming different APIs (patient and encounter) using FHIR client, and based on different error scenarios we have different workflows, not able to get proper error response in this particular scenario kind of disrupt the workflow

from client-js.

vlad-ignatov avatar vlad-ignatov commented on July 1, 2024

I understand that, but it would help if you can define "proper error response".

from client-js.

SA030800 avatar SA030800 commented on July 1, 2024

To add on @BS062721 comment, since an error status is not returned along with the error message we wouldn't know it fails because of some server error(500) or because we are providing invalid data(400) or the resource is not found(404) etc. so we are unable to give a proper error message to the end user.

Example if the status is 500 we would give them an error message explaining it is a server error with an option to retry again. if it was a 404 error we will give them an error message explaining the resource is not found.

On another note: the search api's seems to return an error with error status it is just the read api which is not returning the error status

from client-js.

vlad-ignatov avatar vlad-ignatov commented on July 1, 2024

I agree that this needs to be fixed. The hard part though, is to figure out how to do that without breaking existing apps too much.

Looking at the code, I can see that a request promise can be rejected with different arguments - string messages, error instances, jQuery XHR objects... It would be nice if we could unify this and always return an object with the same shape.

What are the exact properties that you expect to find in an object, representing a failed response?

from client-js.

BS062721 avatar BS062721 commented on July 1, 2024

for all other scenarios we are getting error response status property which gives us the proper error code for given scenario.

for example something like error.status = 400 then we parse error response based on code

from client-js.

vlad-ignatov avatar vlad-ignatov commented on July 1, 2024

This was an issue with the older version of the client and its integration with fhir.js. We have new versions now, and they should reject with HttpError in such cases.

I am closing this now, but feel free to open new one if you have issues with the newer versions.

from client-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.