在玩redux-saga时,注意到发生错误时的调用效果传递给catch子句只是错误的文本。我如何访问响应状态代码?例如,如果状态代码为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
}