Skip to content

Commit 4c7b5ae

Browse files
committed
Add Unauthorized401Exception
1 parent 974c3c6 commit 4c7b5ae

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Elasticsearch\Common\Exceptions;
4+
5+
/**
6+
* Unauthorized401Exception, thrown on 401 unauthorized http error
7+
*
8+
* @category Elasticsearch
9+
* @package Elasticsearch\Common\Exceptions
10+
* @author Zachary Tong <[email protected]>
11+
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
12+
* @link http://elastic.co
13+
*/
14+
class Unauthorized401Exception extends \Exception implements ElasticsearchException
15+
{
16+
}

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ private function assertException(\Exception $exception, $expectedError, $testNam
722722
$this->assertRegExp($expectedError, $exception->getMessage(), 'Failed to catch error in test ' . $testName);
723723
} elseif ($exception instanceof BadRequest400Exception && $expectedError === 'bad_request') {
724724
$this->assertTrue(true);
725+
} elseif ($exception instanceof Unauthorized401Exception && $expectedError === 'unauthorized') {
726+
$this->assertTrue(true);
725727
} elseif ($exception instanceof Missing404Exception && $expectedError === 'missing') {
726728
$this->assertTrue(true);
727729
} elseif ($exception instanceof Conflict409Exception && $expectedError === 'conflict') {

0 commit comments

Comments
 (0)