Skip to content

Commit 11d2705

Browse files
committed
Optimize exception trace collector
1 parent f7e4f32 commit 11d2705

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Collectors/ExceptionTraceCollector.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ public function __construct(callable $pipe = null)
3232

3333
public function collect()
3434
{
35-
return collect($this->exception->getTrace())
36-
->filter(function ($trace) {
37-
return isset($trace['file']) and isset($trace['line']);
38-
})
39-
->map(function ($trace) {
40-
return $trace['file']."({$trace['line']})";
35+
return collect(explode("\n", $this->exception->getTraceAsString()))
36+
->transform(function ($trace, $index) {
37+
return ltrim($trace, "#$index ");
4138
})
4239
->all();
4340
}

0 commit comments

Comments
 (0)