Skip to content

Commit 00d29e8

Browse files
change error message
1 parent 22113dc commit 00d29e8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sqlmesh/core/macros.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,21 @@ def snapshots(self) -> t.Dict[str, Snapshot]:
500500
def this_env(self) -> str:
501501
"""Returns the name of the current environment in before after all."""
502502
if "this_env" not in self.locals:
503-
raise SQLMeshError("Environment name is not available in this context")
503+
raise SQLMeshError("Environment name is only available in before_all and after_all")
504504
return self.locals["this_env"]
505505

506506
@property
507507
def schemas(self) -> t.List[str]:
508508
"""Returns the schemas of the current environment in before after all macros."""
509509
if "schemas" not in self.locals:
510-
raise SQLMeshError("Schemas are not available in this context")
510+
raise SQLMeshError("Schemas are only available in before_all and after_all")
511511
return self.locals["schemas"]
512512

513513
@property
514514
def views(self) -> t.List[str]:
515515
"""Returns the views of the current environment in before after all macros."""
516516
if "views" not in self.locals:
517-
raise SQLMeshError("Views are not available in this context")
517+
raise SQLMeshError("Views are only available in before_all and after_all")
518518
return self.locals["views"]
519519

520520
def var(self, var_name: str, default: t.Optional[t.Any] = None) -> t.Optional[t.Any]:

0 commit comments

Comments
 (0)