Skip to content

Improve Error Messaging for Media Upload Failures #1244

Open
@BilalTariq01

Description

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"');
}
.....

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions