implement MissingWorkdirError

This commit is contained in:
MustafaJafar 2025-03-07 14:17:13 +02:00
parent 373c57fafd
commit 1f571e65c1
2 changed files with 5 additions and 2 deletions

View file

@ -27,7 +27,8 @@ from .workfile import (
get_workdir, get_workdir,
get_custom_workfile_template_by_string_context, get_custom_workfile_template_by_string_context,
get_workfile_template_key_from_context, get_workfile_template_key_from_context,
get_last_workfile get_last_workfile,
MissingWorkdirError,
) )
from . import ( from . import (
register_loader_plugin_path, register_loader_plugin_path,
@ -628,7 +629,7 @@ def version_up_current_workfile():
# is not supposed/able to create missing folders. # is not supposed/able to create missing folders.
parent_folder = os.path.dirname(new_workfile_path) parent_folder = os.path.dirname(new_workfile_path)
if not os.path.exists(parent_folder): if not os.path.exists(parent_folder):
raise AssertionError( raise MissingWorkdirError(
f"Work area directory '{parent_folder}' does not exist yet.") f"Work area directory '{parent_folder}' does not exist yet.")
host.save_workfile(new_workfile_path) host.save_workfile(new_workfile_path)

View file

@ -16,6 +16,7 @@ from .path_resolving import (
from .utils import ( from .utils import (
should_use_last_workfile_on_launch, should_use_last_workfile_on_launch,
should_open_workfiles_tool_on_launch, should_open_workfiles_tool_on_launch,
MissingWorkdirError,
) )
from .build_workfile import BuildWorkfile from .build_workfile import BuildWorkfile
@ -46,6 +47,7 @@ __all__ = (
"should_use_last_workfile_on_launch", "should_use_last_workfile_on_launch",
"should_open_workfiles_tool_on_launch", "should_open_workfiles_tool_on_launch",
"MissingWorkdirError",
"BuildWorkfile", "BuildWorkfile",