Async await error message?
See original GitHub issueWhen using .catch()
I get a proper error message with response
, stack
and message
but when i’m using async/await
wrapped in a try/catch
I only get config
Example:
try {
const { data } = await axios.get(forumUrl)
resolve(data)
} catch (error) {
console.log(error) //{config:{...}}
reject(error)
}
Any idea why?
- axios version: e.g.: latest
Issue Analytics
- State:
- Created 6 years ago
- Reactions:51
- Comments:17
Top Results From Across the Web
Error handling with Async/Await in JS | by Ian Segers | ITNEXT
We can use try...catch for synchronous code. · We can use try...catch (in combination with async functions) and the . · When returning...
Read more >Async/Await Error Handling - Beginner JavaScript - Wes Bos
We will talk about error handling strategies for async await in this lesson. ... break the entire application if some of the code...
Read more >Error handling with async/await and promises, n² ... - CatchJS
When dealing with promises, you have no way of knowing if an error will be handled some time in the future. The promise...
Read more >Async/await - The Modern JavaScript Tutorial
If a promise resolves normally, then await promise returns the result. But in the case of a rejection, it throws the error, just...
Read more >Async Await Error Handling in JavaScript - The Code Barbarian
When you're first getting started with async/await, it is tempting to use try/catch around every async operation. That's because if you await on ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
try returning
error.response
, it worked for meHello, Are you using it in the browser or in node? If I do this
I get [“config”, “request”, “response”] “Network Error” so it seems to work properly It seems weird to have something different as async await are just wrapper around promises