ITADN

Improve Error Messaging for Media Upload Failures

#1244ClosedBilalTariq01 创建于 2024-12-31
Triage
B
BilalTariq01commented
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"'); } .....
关闭于 2025-03-12 1 条评论