fix invalid error
This commit is contained in:
parent
50c69fb882
commit
a717cab182
@ -74,15 +74,14 @@ def run_batch(
|
|||||||
try:
|
try:
|
||||||
ensure_dir_exists(input_dir, samba_conn)
|
ensure_dir_exists(input_dir, samba_conn)
|
||||||
except Exception as exc: # noqa: BLE001
|
except Exception as exc: # noqa: BLE001
|
||||||
return BatchResult(
|
return _build_input_dir_error_result(
|
||||||
status="error",
|
input_dir=input_dir,
|
||||||
processed=0,
|
details=str(exc),
|
||||||
partial=0,
|
)
|
||||||
errors=1,
|
if not samba_conn.path_exists(input_dir):
|
||||||
report_path="",
|
return _build_input_dir_error_result(
|
||||||
protocol_path="",
|
input_dir=input_dir,
|
||||||
log_path="",
|
details="Проверьте права на родительский каталог.",
|
||||||
messages=[f"Не удалось создать входную папку: {input_dir}. {exc}"],
|
|
||||||
)
|
)
|
||||||
is_ok, access_error = check_input_dir_access(
|
is_ok, access_error = check_input_dir_access(
|
||||||
input_dir=input_dir, samba_conn=samba_conn
|
input_dir=input_dir, samba_conn=samba_conn
|
||||||
@ -449,3 +448,16 @@ def _format_duration(duration_seconds: float) -> str:
|
|||||||
if minutes:
|
if minutes:
|
||||||
return f"{minutes} мин {seconds} сек"
|
return f"{minutes} мин {seconds} сек"
|
||||||
return f"{seconds} сек"
|
return f"{seconds} сек"
|
||||||
|
|
||||||
|
|
||||||
|
def _build_input_dir_error_result(input_dir: str, details: str) -> BatchResult:
|
||||||
|
return BatchResult(
|
||||||
|
status="error",
|
||||||
|
processed=0,
|
||||||
|
partial=0,
|
||||||
|
errors=1,
|
||||||
|
report_path="",
|
||||||
|
protocol_path="",
|
||||||
|
log_path="",
|
||||||
|
messages=[f"Не удалось создать входную папку: {input_dir}. {details}"],
|
||||||
|
)
|
||||||
|
|||||||
@ -35,6 +35,15 @@ def check_access_and_list_files(
|
|||||||
ensure_dir_exists(input_dir, samba_conn=samba_conn)
|
ensure_dir_exists(input_dir, samba_conn=samba_conn)
|
||||||
except Exception as exc: # noqa: BLE001
|
except Exception as exc: # noqa: BLE001
|
||||||
return False, f"Не удалось создать входную папку: {input_dir}. {exc}", []
|
return False, f"Не удалось создать входную папку: {input_dir}. {exc}", []
|
||||||
|
if not samba_conn.path_exists(input_dir):
|
||||||
|
return (
|
||||||
|
False,
|
||||||
|
(
|
||||||
|
"Не удалось создать входную папку: "
|
||||||
|
f"{input_dir}. Проверьте права на родительский каталог."
|
||||||
|
),
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
|
||||||
ok, error = check_input_dir_access(Path(input_dir), samba_conn=samba_conn)
|
ok, error = check_input_dir_access(Path(input_dir), samba_conn=samba_conn)
|
||||||
if not ok:
|
if not ok:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user