File tree 5 files changed +17
-15
lines changed
5 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateAMiss
359
359
$ error = $ details ->getError ();
360
360
361
361
Assert::assertNotNull ($ error );
362
- Assert::assertEquals ($ errorCode , $ error ->getCode ());
362
+ Assert::assertEquals ($ errorCode , $ error ->getResolutionErrorCode ());
363
363
}
364
364
365
365
/**
@@ -392,7 +392,7 @@ public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateAType
392
392
393
393
Assert::assertNotNull ($ error );
394
394
Assert::assertEquals (
395
- $ error ->getCode (),
395
+ $ error ->getResolutionErrorCode (),
396
396
ErrorCode::TYPE_MISMATCH (),
397
397
);
398
398
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace OpenFeature \implementation \provider ;
6
6
7
+ use Exception ;
7
8
use OpenFeature \interfaces \provider \ErrorCode ;
8
9
use OpenFeature \interfaces \provider \ResolutionError as ResolutionErrorInterface ;
9
10
10
- class ResolutionError implements ResolutionErrorInterface
11
+ class ResolutionError extends Exception implements ResolutionErrorInterface
11
12
{
12
- private ErrorCode $ code ;
13
- private ?string $ message ;
13
+ private ErrorCode $ resolutionErrorCode ;
14
+ private ?string $ resolutionErrorMessage ;
14
15
15
16
public function __construct (ErrorCode $ code , ?string $ message = null )
16
17
{
17
- $ this ->code = $ code ;
18
- $ this ->message = $ message ;
18
+ parent ::__construct ();
19
+ $ this ->resolutionErrorCode = $ code ;
20
+ $ this ->resolutionErrorMessage = $ message ;
19
21
}
20
22
21
- public function getCode (): ErrorCode
23
+ public function getResolutionErrorCode (): ErrorCode
22
24
{
23
- return $ this ->code ;
25
+ return $ this ->resolutionErrorCode ;
24
26
}
25
27
26
- public function getMessage (): ?string
28
+ public function getResolutionErrorMessage (): ?string
27
29
{
28
- return $ this ->message ;
30
+ return $ this ->resolutionErrorMessage ;
29
31
}
30
32
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ interface ResolutionError
20
20
* In cases of abnormal execution, the provider MUST indicate an error using the idioms of the implementation
21
21
* language, with an associated error code and optional associated error message.
22
22
*/
23
- public function getCode (): ErrorCode ;
23
+ public function getResolutionErrorCode (): ErrorCode ;
24
24
25
25
/**
26
26
* ---------------
@@ -29,5 +29,5 @@ public function getCode(): ErrorCode;
29
29
* In cases of abnormal execution, the provider MUST indicate an error using the idioms of the implementation
30
30
* language, with an associated error code and optional associated error message.
31
31
*/
32
- public function getMessage (): ?string ;
32
+ public function getResolutionErrorMessage (): ?string ;
33
33
}
Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ public function testClientEvaluationDetailsAbnormalExecutionHasErrorCodeField():
498
498
/** @var ResolutionError $resolutionError */
499
499
$ resolutionError = $ actualDetails ->getError ();
500
500
$ this ->assertNotNull ($ resolutionError );
501
- $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getCode ());
501
+ $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getResolutionErrorCode ());
502
502
}
503
503
504
504
/**
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ public function testMustPopulateErrorFieldInAbnormalExecution(): void
247
247
/** @var ResolutionError $resolutionError */
248
248
$ resolutionError = $ actualResolution ->getError ();
249
249
$ this ->assertNotNull ($ resolutionError );
250
- $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getCode ());
250
+ $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getResolutionErrorCode ());
251
251
}
252
252
253
253
/**
You can’t perform that action at this time.
0 commit comments