| 1 |
<?php |
| 2 |
|
| 3 |
namespace Dudlewebs\WPMCS\s3\Aws\Exception; |
| 4 |
|
| 5 |
use Dudlewebs\WPMCS\s3\Aws\HasMonitoringEventsTrait; |
| 6 |
use Dudlewebs\WPMCS\s3\Aws\MonitoringEventsInterface; |
| 7 |
class CouldNotCreateChecksumException extends \RuntimeException implements MonitoringEventsInterface |
| 8 |
{ |
| 9 |
use HasMonitoringEventsTrait; |
| 10 |
public function __construct($algorithm, ?\Exception $previous = null) |
| 11 |
{ |
| 12 |
$prefix = $algorithm === 'md5' ? "An" : "A"; |
| 13 |
parent::__construct("{$prefix} {$algorithm} checksum could not be " . "calculated for the provided upload body, because it was not " . "seekable. To prevent this error you can either 1) include the " . "ContentMD5 or ContentSHA256 parameters with your request, 2) " . "use a seekable stream for the body, or 3) wrap the non-seekable " . "stream in a GuzzleHttp\\Psr7\\CachingStream object. You " . "should be careful though and remember that the CachingStream " . "utilizes PHP temp streams. This means that the stream will be " . "temporarily stored on the local disk.", 0, $previous); |
| 14 |
} |
| 15 |
} |
| 16 |
|