question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get response object in reject middleware?

See original GitHub issue

Our server returns statuses like 400 with some json explaining what happens. Is there any way, how to get response object in rejectMiddleware to get these data and respond to them globally?

trae.after(null, (err) => {
  // Give me the response here :(
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
schovicommented, Mar 9, 2017

@gillchristian Sorry. By “raw response” I mean same as for success ofc 😃

For me it makes sense to add response to Error object. It feels natural to me and it is something what I always look for when using some library.

Other features like customizing valid status sounds great too. It can give you more precise controling, but on other hand I am not sure, how much complex and customizable should trae be. I would recommend to discuss it separately in other issue.

2reactions
gillchristiancommented, Mar 28, 2017

Closing since #60 was merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a middleware to verify a response object before ...
I want to have a middleware that takes all my responses and verifies them against the expected object schemas. The issue what I'm...
Read more >
Reject (FAIL) action based on response · Issue #71 - GitHub
Reject (FAIL) action based on response #71 ... With redux-axios-middleware I can get the action to fail with returnRejectedPromiseOnError ...
Read more >
Writing middleware for use in Express apps
Middleware functions can perform the following tasks: Execute any code. Make changes to the request and the response objects. End the request-response cycle....
Read more >
Using Express.js Routes for Promise-based Error Handling
Express.js middleware functions are functions that have access to the request object (typically "req"), the response object ("res"), and the next middleware ......
Read more >
A Guide to Error Handling in Express.js | Scout APM Blog
Express Middleware Functions; Default Error Handling in Express.js ... They have access to the request and the response objects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found