drkwpgrdb092239314 2013-06-14 19:37
浏览 89

AngularJS HTTP post抛出异常

Greetings Overflowers,

My angularjs http.post throws an exception when my php server returns with HTTP error status 500 (Internal Server Error) although I have registered my error function to handle it. How can I stop these exceptions from being thrown?

Kind regards

EDIT: I am faking the error from my php server to see how the client behaive using this command:

header('HTTP/1.1 500 Internal Server Error');

On the client I am using (URL in here is not real):

http.post('query.php', {query: 'err'})
.success(function (data) {
console.log(data);
})
.error(function (err, status) {
console.log(status, err);
});

However registered an error function, I am still getting a thrown exception from angularjs saying something like:

POST status 500 (Internal Server Error)

Although, the web app continues to run as expected so I thought this might be normal? Specially that in angularjs.org site under HTTP service example when you change the url of the http get to something invalid you also get an exception with status 400 even with the registered error function. So am I missing something on how to stop this exception from being thrown (I see it in Chrome console)?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型