From b923c40e0b4528d8590a12c271cba98c9b9b32bf Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 15 Oct 2024 12:08:01 +0200
Subject: [PATCH] fix(yaml): allow filtering of invalid multidoc (#31963)

---
 lib/util/yaml.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/util/yaml.ts b/lib/util/yaml.ts
index e483b762cf..ac38840ead 100644
--- a/lib/util/yaml.ts
+++ b/lib/util/yaml.ts
@@ -63,19 +63,19 @@ export function parseYaml<ResT = unknown>(
 
   const results: ResT[] = [];
   for (const rawDocument of rawDocuments) {
-    const document = rawDocument.toJS({ maxAliasCount: 10000 });
-
     const errors = rawDocument.errors;
     // handle YAML parse errors
     if (errors?.length) {
       const error = new AggregateError(errors, 'Failed to parse YAML file');
       if (options?.failureBehaviour === 'filter') {
-        logger.debug({ error, document }, 'Failed to parse YAML');
+        logger.debug(`Failed to parse YAML file: ${error.message}`);
         continue;
       }
       throw error;
     }
 
+    const document = rawDocument.toJS({ maxAliasCount: 10000 });
+
     // skip schema validation if no schema is provided
     if (!schema) {
       results.push(document as ResT);
-- 
GitLab