在这里插入图片描述
在VUE中,我封装了请求方法,对于接口返回的500错误仅抛出了异常没有进行处理,在实际使用我需要对接口返回的500错误进行二次处理。 taskreject(this.dynamicValidateForm).then(response => {
console.log(response);
return
this.rejectdis = false;
this.dialogVisible = false
this.$router.push({ path: ‘/processManage/backlog’});
}); 这是我当前的写法,我需要处理接口返回500的情况 ,如何处理

taskreject(this.dynamicValidateForm)
.then(response => {
// 处理成功的情况
console.log(response);
this.rejectdis = false;
this.dialogVisible = false;
this.KaTeX parse error: Expected 'EOF', got '}' at position 52: …backlog' }); }̲) .catch(erro…message.error(‘服务器内部错误,请稍后重试’);
} else {
// 处理其他错误
console.error(‘请求失败:’, error);
this.$message.error(‘请求失败,请检查网络或稍后重试’);
}
});

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐