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

There's no way to view error returned from Twitter API? #14

Open
jraoatlogic opened this issue Mar 26, 2020 · 0 comments
Open

There's no way to view error returned from Twitter API? #14

jraoatlogic opened this issue Mar 26, 2020 · 0 comments

Comments

@jraoatlogic
Copy link

Expected behavior

When client.sendTwitterRequest fails due to an error from Twitter (for example 400 bad request), there needs to be a way to view the response body since it has the detailed error message from Twitter.

Actual behavior

There's no way to view the response body when request fails, the response and data object are nil, and connectionError doesn't show the error from the response body.

    [client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        if (data) {
            // handle the response data e.g.
            NSError *jsonError;
            NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
        }
        else {
            NSLog(@"Error: %@", connectionError);
        }
    }];

Steps to reproduce the behavior

Try calling a Twitter API with invalid parameters, for example https://upload.twitter.com/1.1/media/upload.json

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