Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cyclic handling and resolve bug #63206 in error and exception han… #60

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "PHP errors Catcher module for Hawk.so",
"keywords": ["hawk", "php", "error", "catcher"],
"type": "library",
"version": "2.2.1",
"version": "2.2.2",
"license": "MIT",
"require": {
"ext-curl": "*",
Expand Down
19 changes: 12 additions & 7 deletions src/Catcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class Catcher
private static $instance;

/**
* SDK handler: contains methods that catchs errors and exceptions
* SDK handler: contains methods that catch errors and exceptions
*
* @var Handler
*/
Expand Down Expand Up @@ -70,7 +70,7 @@ public static function get(): Catcher
*/
public function setUser(array $user): self
{
$this->handler->withUser($user);
$this->handler->setUser($user);

return $this;
}
Expand All @@ -82,7 +82,7 @@ public function setUser(array $user): self
*/
public function setContext(array $context): self
{
$this->handler->withContext($context);
$this->handler->setContext($context);

return $this;
}
Expand All @@ -99,7 +99,7 @@ public function setContext(array $context): self
*/
public function sendMessage(string $message, array $context = []): void
{
$this->handler->catchEvent([
$this->handler->sendEvent([
'title' => $message,
'context' => $context
]);
Expand All @@ -109,6 +109,8 @@ public function sendMessage(string $message, array $context = []): void
* @param Throwable $throwable
* @param array $context
*
* @throws Throwable
*
* @example
* \Hawk\Catcher::get()
* ->sendException($exception, [
Expand All @@ -117,7 +119,7 @@ public function sendMessage(string $message, array $context = []): void
*/
public function sendException(Throwable $throwable, array $context = [])
{
$this->handler->catchException($throwable, $context);
$this->handler->handleException($throwable, $context);
}

/**
Expand All @@ -131,7 +133,7 @@ public function sendException(Throwable $throwable, array $context = [])
*/
public function sendEvent(array $payload): void
{
$this->handler->catchEvent($payload);
$this->handler->sendEvent($payload);
}

/**
Expand All @@ -156,6 +158,9 @@ private function __construct(array $options)
$transport = new CurlTransport($options->getUrl());

$this->handler = new Handler($options, $transport, $builder);
$this->handler->enableHandlers();

$this->handler->registerErrorHandler();
$this->handler->registerExceptionHandler();
$this->handler->registerFatalHandler();
}
}
7 changes: 7 additions & 0 deletions src/Exception/SilencedErrorException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Hawk\Exception;

class SilencedErrorException extends \ErrorException
{
}
Loading
Loading