Browse Source

Add version check for the AWS SDK, refs #260

Jordi Boggiano 12 years ago
parent
commit
516447f913
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Monolog/Handler/DynamoDbHandler.php

+ 5 - 0
src/Monolog/Handler/DynamoDbHandler.php

@@ -11,6 +11,7 @@
 
 namespace Monolog\Handler;
 
+use Aws\Common\Aws;
 use Aws\DynamoDb\DynamoDbClient;
 use Monolog\Formatter\ScalarFormatter;
 use Monolog\Handler\AbstractProcessingHandler;
@@ -44,6 +45,10 @@ class DynamoDbHandler extends AbstractProcessingHandler
      */
     public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
     {
+        if (!defined('Aws\Common\Aws::VERSION') || version_compare('3.0', Aws::VERSION, '<=')) {
+            throw new \RuntimeException('The DynamoDbHandler is only known to work with the AWS SDK 2.x releases');
+        }
+
         $this->client = $client;
         $this->table = $table;