Skip to content

Commit

Permalink
Add fallback error message when policy signing fail
Browse files Browse the repository at this point in the history
  • Loading branch information
DocLM committed Jan 10, 2024
1 parent 4c4ceaf commit 4189548
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/CloudFront/Signer.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ private function sign($policy)
$errorMessages[] = $newMessage;
}

throw new \RuntimeException(implode("\n",$errorMessages));
$exceptionMessage = "An error has occurred when signing the policy";
if (count($errorMessages) > 0) {
$exceptionMessage = implode("\n", $errorMessages);
}

throw new \RuntimeException($exceptionMessage);
}

return $signature;
Expand Down

0 comments on commit 4189548

Please sign in to comment.