Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/OpenFeatureClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,10 @@ private function evaluateFlag(
),
);

$error = $err instanceof ThrowableWithResolutionError ? $err->getResolutionError() : new ResolutionError(ErrorCode::GENERAL());
$error = $err instanceof ThrowableWithResolutionError ? $err->getResolutionError() : new ResolutionError(ErrorCode::GENERAL(), $err->getMessage());

$details = (new EvaluationDetailsBuilder())
->withFlagKey($flagKey)
->withValue($defaultValue)
->withReason(Reason::ERROR)
->withError($error)
Expand Down
10 changes: 8 additions & 2 deletions tests/unit/OpenFeatureClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public function testClientEvaluationDetailsAbnormalExecutionHasErrorCodeField():
$resolutionError = $actualDetails->getError();
$this->assertNotNull($resolutionError);
$this->assertEquals($expectedErrorCode, $resolutionError->getResolutionErrorCode());
$this->assertEquals('flagKey', $actualDetails->getFlagKey());
}

/**
Expand Down Expand Up @@ -563,9 +564,14 @@ public function testClientShouldLogInformativeErrorDuringAbnormalExecution(): vo
$client = new OpenFeatureClient($api, 'test-name', 'test-version');
$client->setLogger($mockLogger);

$value = $client->getBooleanValue('flagKey', false);
$details = $client->getBooleanDetails('flagKey', false);

$this->assertEquals($value, false);
$this->assertEquals(false, $details->getValue());
$this->assertEquals('flagKey', $details->getFlagKey());

$this->assertInstanceOf(ResolutionError::class, $details->getError());
$this->assertEquals(ErrorCode::GENERAL(), $details->getError()->getResolutionErrorCode());
$this->assertEquals('NETWORK_ERROR', $details->getError()->getResolutionErrorMessage());
}

/**
Expand Down