Skip to content

Commit

Permalink
improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sid-acryl committed Aug 1, 2024
1 parent a56aecc commit 33f66be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sqlglot/optimizer/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,9 @@ def traverse(self):
scope.subquery_scopes,
)
)
if len(result) > MAX_SCOPE_DEPTH:
raise OptimizeError("Scope depth limit exceeded")
actual_depth = len(result)
if actual_depth > MAX_SCOPE_DEPTH:
raise OptimizeError(f"Scope depth limit({actual_depth}) exceeded max depth limit({MAX_SCOPE_DEPTH})")

yield from reversed(result)

Expand Down

0 comments on commit 33f66be

Please sign in to comment.