Comments (5)
Does
app.service('/messages').create({
text: 'Hello'
}).then(result => {
...
}).catch(error => {
return error.response.json() // Never resolves
}).catch(console.error.bind(console));
log anything? I'm wondering if error.response.json()
throws (I'm not sure what it's supposed to do) or something before.
from feathers-rest.
This is the closest I can get at replicating.
https://github.com/mcchrish/feathers-fetch-error
Sorry, it requires a couple of steps:
npm start
Then test by mocha:
mocha test/client.test.js
It pauses at return error.response.json()
then mocha will timeout.
from feathers-rest.
If you return
something in a Promise catch
, that promise is no longer rejected. In your example (thank you for uploading) something like
app.service('/messages').create({})
.catch(error => {
console.log('!!!!', error.message);
throw error;
})
Works as expected. If you make sure that you have the latest version of feathers-rest
installed (the one that includes #53) the error will also be converted properly to a Feathers error and there shouldn't be a reason for calling error.response.json()
.
from feathers-rest.
Oh, so that's what changed.
Using 1.4.* currently, while reverting 1.3.0 makes my code works.
That's why there is no need for error.response.json()
anymore, which is pretty neat.
Thanks 👍
from feathers-rest.
Ah sorry, I didn't think it would be a breaking change since the REST error handling (especially for fetch and jQuery) was kind of broken before but obviously it needed to be worked around then. Glad we figured it out and hopefully this fix will make things easier.
from feathers-rest.
Related Issues (20)
- Consider how to handle file upload HOT 5
- Add headers and remote IP
- res.hook should exist in middleware after errors
- Setting 'content-type' header properly with boundary HOT 3
- $in: [] returning unexpected results HOT 2
- JSON-API + feathers-rest HOT 4
- Property 'axios' does not exist on type 'Transport' HOT 4
- $gte query example? HOT 2
- Map route parameters to `params.route` HOT 1
- How to return a pdf download file instead of data ?
- Update returning 204 HOT 2
- An in-range update of feathers is breaking the build 🚨 HOT 1
- Prepare for feathers v3 HOT 9
- Angular http implementation error HOT 1
- Client fails to parse json response on 204 status using fetch HOT 2
- $in operator doesn't work correctly through rest HOT 15
- fn.call is not a function(…) on client side with webpack HOT 2
- Client: Support Service Middleware / Generic Service HOT 5
- support axios? HOT 3
- Custom HTTP status code response HOT 4
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 feathers-rest.