@@ -349,7 +349,7 @@ def _load(path: Path) -> t.List[Model]:
349349 for row in YAML ().load (file .read ())
350350 ]
351351 except Exception as ex :
352- raise ConfigError (self ._failed_to_load_model_error (path , ex ))
352+ raise ConfigError (self ._failed_to_load_model_error (path , ex ), path )
353353
354354 for path in paths_to_load :
355355 self ._track_file (path )
@@ -363,7 +363,8 @@ def _load(path: Path) -> t.List[Model]:
363363 raise ConfigError (
364364 self ._failed_to_load_model_error (
365365 path , f"Duplicate external model name: '{ model .name } '."
366- )
366+ ),
367+ path ,
367368 )
368369 models [model .fqn ] = model
369370
@@ -375,7 +376,8 @@ def _load(path: Path) -> t.List[Model]:
375376 raise ConfigError (
376377 self ._failed_to_load_model_error (
377378 path , f"Duplicate external model name: '{ model .name } '."
378- )
379+ ),
380+ path ,
379381 )
380382 models .update ({model .fqn : model })
381383
@@ -402,13 +404,15 @@ def _load_requirements(self) -> t.Tuple[t.Dict[str, str], t.Set[str]]:
402404 args = [k .strip () for k in line .split ("==" )]
403405 if len (args ) != 2 :
404406 raise ConfigError (
405- f"Invalid lock file entry '{ line .strip ()} '. Only 'dep==ver' is supported"
407+ f"Invalid lock file entry '{ line .strip ()} '. Only 'dep==ver' is supported" ,
408+ requirements_path ,
406409 )
407410 dep , ver = args
408411 other_ver = requirements .get (dep , ver )
409412 if ver != other_ver :
410413 raise ConfigError (
411- f"Conflicting requirement { dep } : { ver } != { other_ver } . Fix your { c .REQUIREMENTS } file."
414+ f"Conflicting requirement { dep } : { ver } != { other_ver } . Fix your { c .REQUIREMENTS } file." ,
415+ requirements_path ,
412416 )
413417 requirements [dep ] = ver
414418
@@ -619,13 +623,14 @@ def _load_sql_models(
619623 raise ConfigError (
620624 self ._failed_to_load_model_error (
621625 path , f"Duplicate SQL model name: '{ model .name } '."
622- )
626+ ),
627+ path ,
623628 )
624629 elif model .enabled :
625630 model ._path = path
626631 models [model .fqn ] = model
627632 except Exception as ex :
628- raise ConfigError (self ._failed_to_load_model_error (path , ex ))
633+ raise ConfigError (self ._failed_to_load_model_error (path , ex ), path )
629634
630635 return models
631636
@@ -678,7 +683,7 @@ def _load_python_models(
678683 if model .enabled :
679684 models [model .fqn ] = model
680685 except Exception as ex :
681- raise ConfigError (self ._failed_to_load_model_error (path , ex ))
686+ raise ConfigError (self ._failed_to_load_model_error (path , ex ), path )
682687
683688 finally :
684689 model_registry ._dialect = None
@@ -782,7 +787,9 @@ def _load_metrics(self) -> UniqueKeyDict[str, MetricMeta]:
782787 metric = load_metric_ddl (expression , path = path , dialect = dialect )
783788 metrics [metric .name ] = metric
784789 except SqlglotError as ex :
785- raise ConfigError (f"Failed to parse metric definitions at '{ path } ': { ex } ." )
790+ raise ConfigError (
791+ f"Failed to parse metric definitions at '{ path } ': { ex } ." , path
792+ )
786793
787794 return metrics
788795
@@ -1005,7 +1012,7 @@ def _load_scripts(self) -> t.Tuple[MacroRegistry, JinjaMacroRegistry]:
10051012 package = package ,
10061013 )
10071014 except Exception as e :
1008- raise ConfigError (f"Failed to load macro file: { path } " , e )
1015+ raise ConfigError (f"Failed to load macro file: { e } " , path )
10091016
10101017 self ._macros_max_mtime = macros_max_mtime
10111018
0 commit comments