Skip to content

Commit f1e4974

Browse files
committed
fix error messaging on latch register
Signed-off-by: Ayush Kamat <[email protected]>
1 parent 8f0d97f commit f1e4974

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Types of changes
1616

1717
# Latch SDK Changelog
1818

19+
## 2.67.3 - 2025-08-27
20+
21+
### Fixed
22+
23+
* Better error messaging when running `latch register` in a non-workflow directory
24+
1925
## 2.67.2 - 2025-08-26
2026

2127
### Dependencies

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include = ["src/**/*.py", "src/**/py.typed", "src/latch_cli/services/init/*"]
1212

1313
[project]
1414
name = "latch"
15-
version = "2.67.2"
15+
version = "2.67.3"
1616
description = "The Latch SDK"
1717
authors = [{ name = "Kenny Workman", email = "[email protected]" }]
1818
maintainers = [{ name = "Ayush Kamat", email = "[email protected]" }]

src/latch_cli/centromere/ctx.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,25 @@ def __init__(
187187
# fixme(ayush): this sucks
188188
module_path = pkg_root / Path(self.wf_module.replace(".", "/"))
189189

190+
error_msg = (
191+
dedent(
192+
f"""
193+
Unable to locate workflow module `{self.wf_module}` in `{self.pkg_root.resolve()}`. Check that:
194+
195+
1. {module_path} exists.
196+
2. Package `{self.wf_module}` is an absolute importable Python path (e.g. `workflows.my_workflow`).
197+
3. All directories in `{module_path}` contain an `__init__.py` file."""
198+
),
199+
)
200+
190201
try:
202+
if not module_path.exists():
203+
click.secho(error_msg, fg="red")
204+
raise click.exceptions.Exit(1)
205+
191206
flyte_objects = get_flyte_objects(module_path)
192207
except ModuleNotFoundError as e:
193-
click.secho(
194-
dedent(
195-
f"""
196-
Unable to locate workflow module `{self.wf_module}` in `{self.pkg_root.resolve()}`. Check that:
197-
198-
1. {module_path} exists.
199-
2. Package `{self.wf_module}` is an absolute importable Python path (e.g. `workflows.my_workflow`).
200-
3. All directories in `{module_path}` contain an `__init__.py` file."""
201-
),
202-
fg="red",
203-
)
208+
click.secho(error_msg, fg="red")
204209
raise click.exceptions.Exit(1) from e
205210

206211
wf_name: Optional[str] = None

0 commit comments

Comments
 (0)