@@ -12,9 +12,10 @@ import io.github.datacatering.datacaterer.core.model.Constants.METADATA_CONNECTI
1212import io .github .datacatering .datacaterer .core .model .PlanRunResults
1313import io .github .datacatering .datacaterer .core .parser .PlanParser
1414import io .github .datacatering .datacaterer .core .util .SparkProvider
15+ import org .apache .log4j .Logger
1516import org .apache .spark .sql .SparkSession
1617
17- import scala .util .{Success , Try }
18+ import scala .util .{Failure , Success , Try }
1819
1920object PlanProcessor {
2021
@@ -147,6 +148,8 @@ object PlanProcessor {
147148 private def findYamlPlanFile (configuredPlanPath : String , planName : String )(implicit sparkSession : SparkSession ): Option [String ] = {
148149 import java .io .File
149150
151+ val logger = Logger .getLogger(getClass.getName)
152+
150153 // Get the parent directory from the configured plan file path
151154 val planFile = new File (configuredPlanPath)
152155 val planDir = if (planFile.isDirectory) planFile else new File (planFile.getParent)
@@ -160,7 +163,12 @@ object PlanProcessor {
160163 Try {
161164 val parsed = PlanParser .parsePlan(f.getAbsolutePath)
162165 parsed.name.equalsIgnoreCase(planName)
163- }.getOrElse(false )
166+ } match {
167+ case Success (matches) => matches
168+ case Failure (ex) =>
169+ logger.warn(s " Failed to parse YAML plan file: ${f.getAbsolutePath}" , ex)
170+ false
171+ }
164172 })
165173
166174 matchingFiles.headOption.map(_.getAbsolutePath)
0 commit comments