Request Cancellation

preview_player
Показать описание
Every week in my Tuesday Lunch & Learn livestream, we choose a useful software development skill, define a challenge related to that skill, and solve the challenge live. This week, we’re cancelling network requests.

In past episodes, we built a small command-line application that uses a microservice to encode text. We put a lot of effort into error handling, including making sure that the client times out if the microservice doesn’t respond.

There’s a catch, though: although the client times out and displays an error, it doesn’t actually cancel the request, so the application doesn’t exit. In today’s episode, we fix that problem.

Рекомендации по теме
Комментарии
Автор

Personally, I would have wrapped the promise so that it has the cancellation function on itself. Then the return type needn't have changed and bubbled up.

CrapE_DM