now there is a scenario: I need to send data requests for four channels, that is, after requesting channel 1, some data will be put into the variable map- > 1, and there is no data to empty the data to the variable map- > 1. After this process is completed, channel 2 is requested until the channel 4 request is completed. Then call the fully processed variable map
< H2 > the environmental background of the problem and what methods you have tried < / H2 > I have used promise:, but promise cannot then the next request after a request error. Go directly to catch;
I use promise.all:, but as long as there is a request error, it will return an error and cannot realize the location of empty data in map.
/ / Please paste the code text below (do not replace the code with pictures)
request("/union/perfomace/getPeformanceName", {})
.then(function(response1) {
return request("/union/perfomace/getPeformancePlan", {peformanceName: response1.peformanceName[0]});
})
.then(function(response2) {
return request("/union/hall/getHallInfo", {plan: response2.plans[0]});
});
---------------------
< H2 > what result do you expect? What is the error message actually seen? < / H2 >
does not interrupt any of the four requests until the end, and then invokes the last processed map variable.