Skip to content

Commit

Permalink
add exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaschen committed Mar 22, 2019
1 parent 0437f8f commit 26ec36d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Formatter/Polygon/GeoJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ class GeoJSON implements FormatterInterface
public function format(Polygon $polygon): string
{
if ($polygon->getNumberOfPoints() < 3) {
throw new InvalidPolygonException();
throw new InvalidPolygonException('A polygon must consist of at least three points.');
}

$points = [];

/** @var Coordinate $point */
Expand All @@ -35,7 +36,7 @@ public function format(Polygon $polygon): string

return json_encode(
[
'type' => 'Polygon',
'type' => 'Polygon',
'coordinates' => [$points],
]
);
Expand Down

0 comments on commit 26ec36d

Please sign in to comment.