-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop logging donor object in it's entirety and just log the selected …
…information. (#2969) * Stop logging donor object in it's entirety and just log the uId. * Refactor exceptions so that we can differentiate between loggable and non-loggable data. * Fix up test coverage * Broken Cleansing exception test * Ensure logging handled in base ApiException * Silly PHPCS grumbling about something I literally can't change without breaking code. * Handle default exception code differently to stop PHPCS from grumbling.
- Loading branch information
Showing
33 changed files
with
624 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
service-api/app/src/App/src/Exception/LoggableAdditionalDataInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exception; | ||
|
||
interface LoggableAdditionalDataInterface | ||
{ | ||
public function getAdditionalDataForLogging(): array; | ||
} |
33 changes: 33 additions & 0 deletions
33
service-api/app/src/App/src/Exception/LpaActivationKeyAlreadyRequestedException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exception; | ||
|
||
use Fig\Http\Message\StatusCodeInterface; | ||
|
||
class LpaActivationKeyAlreadyRequestedException extends AbstractApiException implements LoggableAdditionalDataInterface | ||
{ | ||
public const MESSAGE = 'Activation key already requested for LPA'; | ||
public const TITLE = 'Bad Request'; | ||
public const CODE = StatusCodeInterface::STATUS_BAD_REQUEST; | ||
|
||
public function __construct(array $additionalData = []) | ||
{ | ||
parent::__construct(self::TITLE, self::MESSAGE, self::CODE, $additionalData); | ||
} | ||
|
||
public function getAdditionalDataForLogging(): array | ||
{ | ||
$data = $this->getAdditionalData(); | ||
|
||
// choose to be explicit about what is being logged to avoid leakage. | ||
return [ | ||
'donor' => [ | ||
'uId' => $data['donor']['uId'] ?? '', | ||
], | ||
'caseSubtype' => $data['caseSubtype'] ?? '', | ||
'activationKeyDueDate' => $data['activationKeyDueDate'] ?? '', | ||
]; | ||
} | ||
} |
Oops, something went wrong.