Skip to content

Commit

Permalink
Add previous exception message when existing
Browse files Browse the repository at this point in the history
  • Loading branch information
icarojerry committed Jul 14, 2021
1 parent f65898a commit 9630171
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Exception/VespaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class VespaException extends \Exception
{
public function __construct($message, \Exception $exception = null)
{
$previous_message = "\n{$exception->getMessage()}" ?? "";
$previous_message = $exception ? "\n{$exception->getMessage()}" : "";

parent::__construct("{$message}{$previous_message}", 001, $exception);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/VespaFailSendDocumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class VespaFailSendDocumentException extends VespaException

public function __construct(DocumentDefinition $definition, AbstractDocument $document, \Exception $exception = null)
{
$previous_message = " {$exception->getMessage()}" ?? "";
$previous_message = $exception ? " {$exception->getMessage()}" : "";

parent::__construct("[{$definition->getDocumentType()}]: Document {$document->getVespaDocumentId()} was not indexed to Vespa.{$previous_message}", $exception);

$this->code = 400;
Expand Down

0 comments on commit 9630171

Please sign in to comment.