From cc4961adf62f05a50afe53938537e9dc7930f24b Mon Sep 17 00:00:00 2001 From: Ryan Reed Date: Wed, 29 Jun 2022 19:12:16 -0400 Subject: [PATCH] Removing the custom exceptions for now --- transpose/utils.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/transpose/utils.py b/transpose/utils.py index 78e168f..e58762b 100644 --- a/transpose/utils.py +++ b/transpose/utils.py @@ -4,7 +4,6 @@ from typing import Dict import json from . import version -from .exceptions import TransposeError def check_path(path: Path, is_symlink: bool = False) -> bool: @@ -63,10 +62,7 @@ def move(source: Path, destination: Path) -> None: """ Move a file using pathlib """ - try: - source.rename(destination) - except FileExistsError: - raise TransposeError(f"Destination already exists: {destination}") + source.rename(destination) def remove(path: Path) -> None: @@ -76,19 +72,11 @@ def remove(path: Path) -> None: if not path.is_symlink() and not path.is_file(): return - try: - path.unlink() - except FileNotFoundError: - raise TransposeError(f"Could not locate file or symlink: {path}") + path.unlink() def symlink(target_path: Path, symlink_path: Path) -> None: """ Symlink a file or directory """ - try: - symlink_path.symlink_to(target_path) - except FileNotFoundError: - raise TransposeError( - f"Could not create symlink: {symlink_path} -> {target_path}" - ) + symlink_path.symlink_to(target_path)