Skip to content

Commit

Permalink
Merge pull request #7 from clovnrian/master
Browse files Browse the repository at this point in the history
Use class name as detail if exception message is not set
  • Loading branch information
nilportugues authored Jun 21, 2016
2 parents ab554ad + e0bc5fc commit 4488828
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ApiProblem/ApiProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public static function fromException(Exception $exception, $title = '', $type =
$type = self::RFC2616;
}

return new self($code, $exception->getMessage(), $title, $type, $additionalDetails);
$detail = empty($exception->getMessage()) ? get_class($exception) : $exception->getMessage();

return new self($code, $detail, $title, $type, $additionalDetails);
}

/**
Expand Down

0 comments on commit 4488828

Please sign in to comment.