javascript - Rejecting error after opening `.catch` -
are these 2 code blocks same? i'm looking open .catch() , log error still want error "uncaught", can return it? or need wrapped in promise.reject()?
block a:
sosomething() .then(() => { return "meow" }) .catch(() => { console.log(err) return err }) block b:
sosomething() .then(() => { return "meow" }) .catch(() => { console.log(err) return promise.reject(err) })
the 2 patterns not same.
the first handles error , returns resolved promise, reaching first function parameter @ chained .then().
the second example returns rejected promise, reaching second function parameter @ chained .then() or .catch().
i'm looking open
.catch(), log error still want error "uncaught", can return it?
the first pattern should meet requirement.
Comments
Post a Comment