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

Fix logic operands + Twitter error response message #10

Merged
merged 3 commits into from
Jul 5, 2022

Conversation

adam-riha
Copy link

Hi Felix,

this PR fixes logical operators error and TwitterException.php

  • convert logical operators to uppercase

    Twitter error response: 
    Ambiguous use of or as a keyword. Use OR to logically join two clauses, or "or" to find occurrences of or in text
    
  • Twitter is probably no longer attaching an error ID, but instead a type to the response.
    I also kept the ID if it was part of the response.

    // TwitterException::fromPayload
    
    $payload = [
      "value" => "__RULE_HERE__"
      "details" => array:1 [
        0 => "Ambiguous use of or as a keyword. Use OR to logically join two clauses, or "or" to find occurrences of or in text (at position 25)"
      ]
      "title" => "UnprocessableEntity"
      "type" => "https://api.twitter.com/2/problems/invalid-rules"
    ]

@felixdorn
Copy link
Owner

Thanks for contributing ! Can you please update the tests accordingly?

There's no contributor guide but you'll also need to regenerate the tests by running composer gen:tests.

@adam-riha
Copy link
Author

Sure thing.


By the way I have a problem with the stream, I can't receive any data from Twitter, even with a very general rule.
I don't know the reason yet I'm trying to debug it.

@felixdorn
Copy link
Owner

felixdorn commented Jul 5, 2022

Sometimes it takes like 30 seconds before you receive something.

Edit: Yes, found the bug, fixed it, released a new version.

The problem was that to make sure an API call succeeded (because Twitter returns 200 on errors), it needs to read the body, and sometimes it's a stream, so it never stops reading.

@felixdorn felixdorn merged commit e680d32 into felixdorn:master Jul 5, 2022
@felixdorn
Copy link
Owner

Thanks!

@felixdorn
Copy link
Owner

I've released 1.0.2, lmk if you're having any more issues!

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

Successfully merging this pull request may close these issues.

2 participants