On May 15, 2012, at 5:55 PM, Mark Volkmann wrote:
> 
> 
> Your call to JSON.parse(data) will throw an error if data isn't valid
> JSON. You should do something like this:
> 
> try {
>  obj = JSON.parse(data);
>  cb(null, obj.response.avatar_url);
> } catch (e) {
>  cb(e);
> }

err= object= null;
try { obj= JSON.parse(data) }
catch (e) { err= e }
cb(err, obj);
-- 
Jorge.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to