Skip to content

Commit 04843bf

Browse files
authored
Merge pull request #6 from websupport-sk/null-exceptions-fixes
Null exceptions fixes
2 parents 672506c + 285e460 commit 04843bf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Client.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public function init()
109109
*/
110110
public function captureMessage(string $message, ?Severity $level = null, ?Scope $scope = null): ?string
111111
{
112+
if ($this->getSentry()->getClient() === null) {
113+
return null;
114+
}
115+
112116
return $this->getSentry()->getClient()->captureMessage($message, $level, $scope);
113117
}
114118

@@ -138,6 +142,11 @@ public function captureException(\Throwable $exception, ?Scope $scope = null): ?
138142
if ($this->rootTransaction !== null) {
139143
$this->rootTransaction->setHttpStatus(500);
140144
}
145+
146+
if ($this->getSentry()->getClient() === null) {
147+
return null;
148+
}
149+
141150
return $this->getSentry()->getClient()->captureException($exception, $scope);
142151
}
143152

0 commit comments

Comments
 (0)