在玩redux-saga时,注意到错误发生时的调用效果传递给catch子句只是错误的文本 . 我如何访问响应状态代码?例如我 grab 如果状态代码是401我想在那里实现一些逻辑 .
例如:
try {
const response = yield call(fetch, uri, options);
//some more logic to dispatch eventual success response
} catch (error) {
console.error('Error:', error);
//here is only printed ie 'Error: TypeError: Failed to fetch' but i need to access as well status code here
}