Issue
I am trying to Catch Error in case any of the async code inside my map fails. It goes inside Error but doesn't log anything. error remains null. Is there some other way to handle Errors in maps?
await dataService.serviceCall()
.map(
async (data: any) => {
Some Async Stuff
}, error => {
Console.log(error);
}
).take(1).toPromise()
Solution
Did you try to catch after you convert to promise like this? This should log error to your console if something in your map fails.
await dataService.serviceCall()
.map(
async (data: any) => {
Some Async Stuff
}
).take(1).toPromise()
.catch(error => {
Console.log(error);
})
Answered By - Programmermid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.