Skip to content

Commit 4488828

Browse files
authored
Merge pull request #7 from clovnrian/master
Use class name as detail if exception message is not set
2 parents ab554ad + e0bc5fc commit 4488828

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ApiProblem/ApiProblem.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ public static function fromException(Exception $exception, $title = '', $type =
135135
$type = self::RFC2616;
136136
}
137137

138-
return new self($code, $exception->getMessage(), $title, $type, $additionalDetails);
138+
$detail = empty($exception->getMessage()) ? get_class($exception) : $exception->getMessage();
139+
140+
return new self($code, $detail, $title, $type, $additionalDetails);
139141
}
140142

141143
/**

0 commit comments

Comments
 (0)