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

Improve Error Messaging for Media Upload Failures #1244

Open
BilalTariq01 opened this issue Dec 31, 2024 · 0 comments
Open

Improve Error Messaging for Media Upload Failures #1244

BilalTariq01 opened this issue Dec 31, 2024 · 0 comments
Labels

Comments

@BilalTariq01
Copy link

BilalTariq01 commented Dec 31, 2024

The error "Missing 'media_id_string'" is misleading when the actual issue is unrelated to media upload, such as an expired user token. Update error handling to display specific API error messages or fallback to the generic message:

private function uploadMediaChunked(string $path, array $parameters)
{
/** @var object $init */
$init = $this->http(
'POST',
self::UPLOAD_HOST,
$path,
$this->mediaInitParameters($parameters),
['jsonPayload' => false],
);
if (!property_exists($init, 'media_id_string')) {
throw new TwitterOAuthException($init->errors[0]->message ?? 'Missing "media_id_string"');
}
.....

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

No branches or pull requests

1 participant