✅ Fixed bulk conversion getting stuck on missing files ✅ Added robust error handling and timeout protection ✅ Improved JavaScript response parsing ✅ Added file existence validation ✅ Fixed missing PHP class imports ✅ Added comprehensive try-catch error recovery 🔧 Key fixes: - File existence checks before conversion attempts - 30-second timeout protection per file - Graceful handling of 500 errors and JSON parsing issues - Automatic continuation to next file on failures - Cache busting for JavaScript updates 🎯 Result: Bulk conversion now completes successfully even with missing files 🚀 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace WebPConvert\Exceptions;
|
|
|
|
/**
|
|
* WebPConvertException is the base exception for all exceptions in this library.
|
|
*
|
|
* Note that the parameters for the constructor differs from that of the Exception class.
|
|
* We do not use exception code here, but are instead allowing two version of the error message:
|
|
* a short version and a long version.
|
|
* The short version may not contain special characters or dynamic content.
|
|
* The detailed version may.
|
|
* If the detailed version isn't provided, getDetailedMessage will return the short version.
|
|
*
|
|
*/
|
|
class WebPConvertException extends \Exception
|
|
{
|
|
public $description = '';
|
|
protected $detailedMessage;
|
|
protected $shortMessage;
|
|
|
|
public function getDetailedMessage()
|
|
{
|
|
return $this->detailedMessage;
|
|
}
|
|
|
|
public function getShortMessage()
|
|
{
|
|
return $this->shortMessage;
|
|
}
|
|
|
|
public function __construct($shortMessage = "", $detailedMessage = "", $previous = null)
|
|
{
|
|
$detailedMessage = ($detailedMessage != '') ? $detailedMessage : $shortMessage;
|
|
$this->detailedMessage = $detailedMessage;
|
|
$this->shortMessage = $shortMessage;
|
|
|
|
parent::__construct(
|
|
$detailedMessage,
|
|
0,
|
|
$previous
|
|
);
|
|
}
|
|
}
|