Skip to content

Commit

Permalink
fix(tar): interceptors 没有正确处理异常
Browse files Browse the repository at this point in the history
  • Loading branch information
js-newbee committed Mar 23, 2019
1 parent 7791edb commit fe8f276
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/taro/src/interceptor/chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Chain {
}
const nextInterceptor = this._getNextInterceptor()
const nextChain = this._getNextChain()
return nextInterceptor(nextChain)
return nextInterceptor(nextChain).catch(err => Promise.reject(err))
}

_getNextInterceptor () {
Expand Down
5 changes: 5 additions & 0 deletions packages/taro/src/interceptor/interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export function timeoutInterceptor (chain) {
clearTimeout(timeout)
resolve(res)
})
.catch(err => {
if (!timeout) return
clearTimeout(timeout)
reject(err)
})
})
}

Expand Down

0 comments on commit fe8f276

Please sign in to comment.