简体   繁体   English

流星调用404错误

[英]Meteor Invoking 404 Error

I'm using cheerio to get the html of a website, and when the website link does not exist (404), meteor.call returns an error instead of proceeding. 我正在使用cheerio获取网站的html,并且当网站链接不存在(404)时,meteor.call返回错误而不是继续。 However, because there are two potential ways the website is formatted for each date, I want to check both and not have meteor throw the 404 error. 但是,由于网站为每个日期设置格式有两种可能的方式,因此我想同时检查这两种方式,并且不要让流星抛出404错误。 How should I approach this? 我应该如何处理?

For example, 例如,

    result2 = Meteor.http.get("http://dining.columbia.edu/43week-ten-friday-breakfast-fbc");
    $ = cheerio.load(result2.content);
    menu2 = $('#main-wrapper').text();

the link returns a page not found error, which is fine- because if the page is not found, I still want to retrieve the html. 链接返回页面未找到错误,这很好-因为如果找不到该页面,我仍要检索html。

Thanks for your help. 谢谢你的帮助。

There is no Meteor.http.get . 没有Meteor.http.get You need to call the HTTP.get method. 您需要调用HTTP.get方法。

See the documentation - http://docs.meteor.com/#/full/http_get 请参阅文档-http://docs.meteor.com/#/full/http_get

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM