Skip to content

Commit

Permalink
improve: add error to entity extra data and skip
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloargentiero authored Feb 22, 2023
1 parent c1a09f8 commit 35c8a43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Refiner/Json/ValidateUrlRefiner.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright © Ghost Unicorns snc. All rights reserved.
* Copyright © Ghost Unicorns snc. All rights reserved.
* See LICENSE for license details.
*/

Expand Down Expand Up @@ -68,8 +68,10 @@ public function execute(int $activityId, string $refinerType, string $entityIden

if ($value) {
if (filter_var($value, FILTER_VALIDATE_URL) === false) {
$errorMessage = __('Invalid url:%1', $value);
$entity->addExtraArray(['skip_reason' => $errorMessage]);
$entity->skip();
throw new CrtImportantException(__('Invalid url:%1', $value));
throw new CrtImportantException($errorMessage);
}
}
}
Expand Down

0 comments on commit 35c8a43

Please sign in to comment.