Comments (9)
CC : @vlad-ignatov
from client-js.
@vlad-ignatov do you have any information on this?
from client-js.
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.
@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.
I understand that, but it would help if you can define "proper error response".
from client-js.
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.
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.
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.
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)
- Client request pre-pends accept header when provided in options HOT 6
- Support for CryptoKey objects as private keys HOT 6
- 502 Gateway Error on codesandbox HOT 2
- Failing in web client projects due to NodeJS usage without polyfills. HOT 13
- Support for browser using multiple SMART clients at once. HOT 3
- Unable to authorize using PKCE HOT 2
- Typo in README
- Unable to get patientId after successful login HOT 1
- (Error handling skipped on init) CompleteAuth not triggered for init HOT 1
- includeResponse not working for FHIR update operations
- "target: popup" (etc) demos don't work in current Chromium HOT 2
- Single SMART_KEY breaks authorization of several users on server-side
- Jest + RTL :: Testing with FHIRClient
- Uncaught (in promise) Error: Failed to fetch the conformance statement from "https://staging-fhir.ecwcloud.com/fhir/r4/FFBJCD/metadata". TypeError: Network request failed HOT 6
- Question: Smart-On-Fhir implementation inside Service Worker
- FHIR type Meta requiring lastUpdated property when spec allows it to be optional
- Node js After 10 min 401 unauthorized response HOT 4
- Window closes itself when it's not actually a popup
- Save token info in DB
- Support of PKCE even when the EHR .well-known configuration is not set? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client-js.