Skip to content

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

@jraoatlogic

Description

@jraoatlogic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions