Skip to content

Commit

Permalink
Add Unauthorized401Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Nov 14, 2017
1 parent ad86f91 commit cc68efd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Elasticsearch/Common/Exceptions/Unauthorized401Exception.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Elasticsearch\Common\Exceptions;

/**
* Unauthorized401Exception, thrown on 401 unauthorized http error
*
* @category Elasticsearch
* @package Elasticsearch\Common\Exceptions
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elastic.co
*/
class Unauthorized401Exception extends \Exception implements ElasticsearchException
{
}
2 changes: 2 additions & 0 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,8 @@ private function assertException(\Exception $exception, $expectedError, $testNam
$this->assertRegExp($expectedError, $exception->getMessage(), 'Failed to catch error in test ' . $testName);
} elseif ($exception instanceof BadRequest400Exception && $expectedError === 'bad_request') {
$this->assertTrue(true);
} elseif ($exception instanceof Unauthorized401Exception && $expectedError === 'unauthorized') {
$this->assertTrue(true);
} elseif ($exception instanceof Missing404Exception && $expectedError === 'missing') {
$this->assertTrue(true);
} elseif ($exception instanceof Conflict409Exception && $expectedError === 'conflict') {
Expand Down

0 comments on commit cc68efd

Please sign in to comment.