File tree Expand file tree Collapse file tree 5 files changed +17
-15
lines changed
Expand file tree Collapse file tree 5 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateAMiss
359359 $ error = $ details ->getError ();
360360
361361 Assert::assertNotNull ($ error );
362- Assert::assertEquals ($ errorCode , $ error ->getCode ());
362+ Assert::assertEquals ($ errorCode , $ error ->getResolutionErrorCode ());
363363 }
364364
365365 /**
@@ -392,7 +392,7 @@ public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateAType
392392
393393 Assert::assertNotNull ($ error );
394394 Assert::assertEquals (
395- $ error ->getCode (),
395+ $ error ->getResolutionErrorCode (),
396396 ErrorCode::TYPE_MISMATCH (),
397397 );
398398 }
Original file line number Diff line number Diff line change 44
55namespace OpenFeature \implementation \provider ;
66
7+ use Exception ;
78use OpenFeature \interfaces \provider \ErrorCode ;
89use OpenFeature \interfaces \provider \ResolutionError as ResolutionErrorInterface ;
910
10- class ResolutionError implements ResolutionErrorInterface
11+ class ResolutionError extends Exception implements ResolutionErrorInterface
1112{
12- private ErrorCode $ code ;
13- private ?string $ message ;
13+ private ErrorCode $ resolutionErrorCode ;
14+ private ?string $ resolutionErrorMessage ;
1415
1516 public function __construct (ErrorCode $ code , ?string $ message = null )
1617 {
17- $ this ->code = $ code ;
18- $ this ->message = $ message ;
18+ parent ::__construct ();
19+ $ this ->resolutionErrorCode = $ code ;
20+ $ this ->resolutionErrorMessage = $ message ;
1921 }
2022
21- public function getCode (): ErrorCode
23+ public function getResolutionErrorCode (): ErrorCode
2224 {
23- return $ this ->code ;
25+ return $ this ->resolutionErrorCode ;
2426 }
2527
26- public function getMessage (): ?string
28+ public function getResolutionErrorMessage (): ?string
2729 {
28- return $ this ->message ;
30+ return $ this ->resolutionErrorMessage ;
2931 }
3032}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ interface ResolutionError
2020 * In cases of abnormal execution, the provider MUST indicate an error using the idioms of the implementation
2121 * language, with an associated error code and optional associated error message.
2222 */
23- public function getCode (): ErrorCode ;
23+ public function getResolutionErrorCode (): ErrorCode ;
2424
2525 /**
2626 * ---------------
@@ -29,5 +29,5 @@ public function getCode(): ErrorCode;
2929 * In cases of abnormal execution, the provider MUST indicate an error using the idioms of the implementation
3030 * language, with an associated error code and optional associated error message.
3131 */
32- public function getMessage (): ?string ;
32+ public function getResolutionErrorMessage (): ?string ;
3333}
Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ public function testClientEvaluationDetailsAbnormalExecutionHasErrorCodeField():
498498 /** @var ResolutionError $resolutionError */
499499 $ resolutionError = $ actualDetails ->getError ();
500500 $ this ->assertNotNull ($ resolutionError );
501- $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getCode ());
501+ $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getResolutionErrorCode ());
502502 }
503503
504504 /**
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ public function testMustPopulateErrorFieldInAbnormalExecution(): void
247247 /** @var ResolutionError $resolutionError */
248248 $ resolutionError = $ actualResolution ->getError ();
249249 $ this ->assertNotNull ($ resolutionError );
250- $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getCode ());
250+ $ this ->assertEquals ($ expectedErrorCode , $ resolutionError ->getResolutionErrorCode ());
251251 }
252252
253253 /**
You can’t perform that action at this time.
0 commit comments