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

Volt exceptions conflicting with HoneyBadger #132

Open
cheekyboots opened this issue Sep 27, 2024 · 0 comments
Open

Volt exceptions conflicting with HoneyBadger #132

cheekyboots opened this issue Sep 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@cheekyboots
Copy link

What are the steps to reproduce this issue?

  1. Use Livewire Volt
  2. Have pretty much any coding issue with a Volt component

What happens?

Honeybadger chokes on:
vendor/honeybadger-io/honeybadger-laravel/src/ContextManager.php:64

with:
explode(): Argument #2 ($string) must be of type string, Closure given

What were you expecting to happen?

I'm not sure if you can do something to actually catch these "Closure given" Volt exceptions, they are Symphony ViewExceptions not normal Laravel exceptions, and right now HoneyBadger doesn't catch them. But Telescope does, if HoneyBadager doesn't choke on this one line.

I fixed it by adding this at the beginning of the function:

private function setLaravelRouteActionContext()
 {
 	$route = Route::getCurrentRoute()->getActionName();
     if (gettype($route) === 'object' && get_class($route) === 'Closure') {
 		
 		$reflection = new ReflectionFunction($route);
 	    $className = get_class($reflection->getClosureThis());
 					
 		if ($className === "Livewire\Volt\VoltManager") {				
 			$routeAction = $reflection->getStaticVariables()['componentName'];
 			$this->honeybadger->setComponent($routeAction);
 			return;
 		}
 	}
@subzero10 subzero10 self-assigned this Sep 29, 2024
@subzero10 subzero10 added the bug Something isn't working label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants