Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error param in callback is not an error object #3

Closed
tmaslen opened this issue Aug 26, 2015 · 2 comments
Closed

Error param in callback is not an error object #3

tmaslen opened this issue Aug 26, 2015 · 2 comments
Labels

Comments

@tmaslen
Copy link

tmaslen commented Aug 26, 2015

Hello,

Really liking openGraphScraper and finding it useful in my project, thanks for making it.

When I get the occasional error from a graph request, an error object is passed but its not a standard JavaScript error. In the documentation it shows dealing with an error like this...

console.log("err:",err);

But this will output as err: err when there is an error.

Is there any chance you could throw a more meaningful error message or give a clearer indication of what is happening when the requested webpage has a problem?

Thanks again for making openGraphScraper,
/t

@YoannB
Copy link

YoannB commented Aug 27, 2015

Hi,

I read code of openGraphScraper and found this :

callback('err',{ success: false, err: 'Invalid URL' })

So if you have err, you can have more info in the second parameter results, like in example :

ogs(options, function(err, results) {
    console.log("err:",err);
    console.log("results:",results);
    console.log("message error:",results.err);
});

++

@jshemas
Copy link
Owner

jshemas commented Feb 5, 2016

YoannB is right, you have to look in the 'results' object to see the real error.

@jshemas jshemas closed this as completed Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants