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

Issues with error function being called from other points in code #19

Open
rickwaugh1 opened this issue Sep 13, 2013 · 0 comments
Open

Comments

@rickwaugh1
Copy link

Hi, not sure if this is an issue with the library or not, but we are having a problem, where after the instagram module is called, another piece of code throws an error,(example was a syntax error in an array union, we ended up trying to call the array as function because of missing period,) and then the error function we had created in the object passed into the instagram library ended up being called with the syntax error.

So sequence:
We call the instagram library with the following object.
We exit successfully, and move on in the code.
A totally unrelated syntax error is thrown.
The error function in this object is called with that error, essentially eating the error and hiding it.

The obj looks like this:

Instagram.users.info(
{
    user_id: 'self',
    complete: function(res)
    {
        if(!res || !res.id)
        {
            error_found = true;
            service_result = {"service":service.source_service,"source_service_id":service.source_service_id,"token":service.token,"message":"Unspecified Problem - no data returned","error":true};
        }
        else if (res.id != service.source_service_id)
        {
            error_found = true;
            service_result = {"service":service.source_service,"source_service_id":service.source_service_id,"token":service.token,"message":"Instagram User Id Not Authorized for This Token","error":true};
        }
        else
        {
            var parsed_result = parse_users_array([res]);
            service_result = {"service":service.source_service,"source_service_id":service.source_service_id,"token":service.token,"token_secret":service.token_secret,"error":false,"display_name":parsed_result[0].display_name,"account_name":parsed_result[0].account_name,"profile_image_url":parsed_result[0].profile_image_url};
        }

        next(null,service_result,error_found);
    },

    error: function(error_message,error_object)
    {
        error_found = true;
        service_results = {"service":service.source_service,"source_service_id":service.source_service_id,"token":service.token,"message":error_message,"error":true};
        next(error_object,service_results,error_found);
    }

});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant