attributing || ! config('extensions.enabled')) { return; } $this->attributing = true; try { $identifier = $this->owner($throwable); if ($identifier !== null) { $this->extensions->recordFailure($identifier, $throwable->getMessage(), $throwable); } } catch (Throwable) { // Attribution is best effort and must never mask the exception being reported. } finally { $this->attributing = false; } } private function normalize(string $path): string { return mb_rtrim(str_replace('\\', '/', $path), '/'); } private function owner(Throwable $throwable): ?string { $vendor = $this->normalize(base_path('vendor')).'/'; foreach ([$throwable->getFile(), ...array_column($throwable->getTrace(), 'file')] as $file) { $file = $this->normalize($file); if (str_starts_with($file, $vendor)) { continue; } foreach ($this->extensions->enabled() as $manifest) { foreach (array_unique([$manifest->directory, realpath($manifest->directory) ?: $manifest->directory]) as $directory) { if (str_starts_with($file, $this->normalize($directory).'/')) { return $manifest->id; } } } return null; } return null; } }