chore: Handle JSON parsing errors in format_docker_command_output_to_json
This commit is contained in:
parent
d98c742aff
commit
ec191af874
@ -48,9 +48,13 @@ function format_docker_command_output_to_json($rawOutput): Collection
|
||||
$outputLines = collect($outputLines);
|
||||
}
|
||||
|
||||
try {
|
||||
return $outputLines
|
||||
->reject(fn ($line) => empty($line))
|
||||
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
||||
} catch (\Throwable $e) {
|
||||
return collect([]);
|
||||
}
|
||||
}
|
||||
|
||||
function format_docker_labels_to_json(string|array $rawOutput): Collection
|
||||
|
Loading…
Reference in New Issue
Block a user