question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publishing a tweet fails with default publish optional parameters

See original GitHub issue

Hello, it’s me again.

I notice an odd behavior that I’m not sure if it comes from twitter or it’s just not handled in the library. Basically, when you share a tweet with a message and an instance of PublishTweetOptionalParameters, if that instance has the default values, like:

var tweet = Twitter.Tweet.PublishTweet(message, new PublishTweetOptionalParameters());

The publishing of that tweet fails. I noticed this when I had the following setup: I have a couple of ads and each ad can have video or image medias. When sharing one of those ads, I first create an instance of PublishTweetOptionalParameters (or options for short). Then I run a check if that ad has any medias, if it does, it tries to upload the first 3 medias, ordered by upload number. If all 3 attempts fail, the options remain with its default values, aka the Medias, MediaIds and MediaBinaries remain empty, which causes Twitter to go nuts and the publication of the given tweet fails.

Because I do my credential validation based on the success of that twitter publish (because the credential validation endpoint has a limit of 15 requests, I can do only 15 tweet publishes for 15 minutes, which is not acceptable), it caused be some problems. It’s not a big deal, I already worked it around, I just wanted to let you know.

https://gist.github.com/Stev3nT/6ff4a807314bb35eadac72473bce0e16 Here is the code that has it worked around, if you are interested. It also fixes my previous issue with uploading videos. I just return null instead of an instance of PublishTweetOptionalParameters when there are no medias uploaded. Since PublishTweet() has a second optional parameter that by default is null, this works.

Cheers!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
linvicommented, Jun 16, 2016

No, the default ExceptionHandler was more supposed to work out as a way to LogExceptions. If you want proper exception handling I would use per request exception handling.

This set of tools is old and will be improved in later versions, but I need to find time to improve this.

0reactions
steventsvetkovcommented, Jun 21, 2016

Hello again. This is not really a bug, just a result from my negligence. Sorry once again and keep doing the awesome work you do!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing Geoprocessing Service that returns error (or ...
I have solved this for publishing GP services by doing this: Publish a service after supplying an empty string as an input parameter....
Read more >
Default Values for Parameter not Working in SSRS 2008 R2
Go the published report on the server and click the drop down arrow on the right and choose 'manage'. Now choose 'Parameters' on...
Read more >
Tweets | Docs
Retrieve Tweet details for the account's full promotable user (default) or the user ... Possible values: DRAFT , PUBLISHED , SCHEDULED. count optional....
Read more >
Media Studio Library
A media library to upload and organize your videos, GIFs and images in a single place. With user roles and permissions that allow...
Read more >
Create and manage publishing states
Ensure that you have a default publishing state by selecting a publishing state record and set the Is Default attribute value to Yes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found