M
M
miliko mikoyan2019-07-01 13:39:03
typescript
miliko mikoyan, 2019-07-01 13:39:03

Failed to narrow error type in catch clause?

async Furia(URL) {
    try {
      const Res = await fetch(URL);
      const Furia0= await Res.json();
      return Furia0;
    } catch (FuriaError) { //type FuriaError?
      return FuriaError;
    }
  }

What type should the FuriaError variable be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey P, 2019-07-01
@miliko0022

the standard Error,
or the Error that is declared in the library you are using.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question