有没有办法阻止失败的HTTP请求在浏览器控制台中显示为错误

Is there a way I can stop a failed HTTP request from showing in the browser console as an error?

本文关键字:控制台 浏览器 显示 错误 请求 HTTP 失败 有没有      更新时间:2023-09-26

我有以下代码:

 entityResource.save(formData,
    function (result) {
        ....
    }, function (result) {
        ...
    });

如果函数保存失败并返回 http://abc.com/api/Content 400(错误请求),则这是在我显示消息时有效。

有没有办法阻止它在Chrome控制台中显示为失败?

也许你可以响应 http 代码 :200,然后响应像 json: {error_code: 400, error_msg: "业务错误"}