Improve error messages
This commit is contained in:
parent
381e50dec6
commit
45347da311
3 changed files with 8 additions and 7 deletions
|
|
@ -79,7 +79,8 @@ def run(args: Any) -> None:
|
||||||
raise CatastrophicError("Aborted")
|
raise CatastrophicError("Aborted")
|
||||||
|
|
||||||
for path in known_files.find_forgotten_files():
|
for path in known_files.find_forgotten_files():
|
||||||
logger.info(f"The file {style_path(path)} is no longer known")
|
logger.info(style_warning("The file ") + style_path(path)
|
||||||
|
+ style_warning(" is no longer known"))
|
||||||
|
|
||||||
known_files.save_final()
|
known_files.save_final()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ The result of loading a config file are the "local" variables,
|
||||||
including the modules loaded via "import".
|
including the modules loaded via "import".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
import logging
|
|
||||||
|
|
||||||
from .colors import *
|
from .colors import *
|
||||||
from .util import *
|
from .util import *
|
||||||
|
|
@ -183,7 +183,7 @@ class Config:
|
||||||
conf = copy
|
conf = copy
|
||||||
break
|
break
|
||||||
except ConfigurationException as e:
|
except ConfigurationException as e:
|
||||||
logger.debug(f"Tried default config file at {style_path(path)} and it didn't work")
|
logger.debug(f"Tried default config file at {style_path(path)} and it didn't work: {e}")
|
||||||
else:
|
else:
|
||||||
raise ConfigurationException(style_error(
|
raise ConfigurationException(style_error(
|
||||||
"No valid config file found in any of the default locations"))
|
"No valid config file found in any of the default locations"))
|
||||||
|
|
|
||||||
|
|
@ -190,14 +190,14 @@ class Processor:
|
||||||
logger.warning(style_warning("The target is a directory"))
|
logger.warning(style_warning("The target is a directory"))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
target_hash = self._obtain_hash(target)
|
|
||||||
if target_hash is None:
|
|
||||||
return prompt_yes_no("Overwriting a file that could not be hashed, continue?", False)
|
|
||||||
|
|
||||||
if self.known_files.was_recently_modified(target):
|
if self.known_files.was_recently_modified(target):
|
||||||
logger.warning(style_warning("This target was already overwritten earlier"))
|
logger.warning(style_warning("This target was already overwritten earlier"))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
target_hash = self._obtain_hash(target)
|
||||||
|
if target_hash is None:
|
||||||
|
return prompt_yes_no("Overwriting a file that could not be hashed, continue?", False)
|
||||||
|
|
||||||
known_target_hash = self.known_files.get_hash(target)
|
known_target_hash = self.known_files.get_hash(target)
|
||||||
if known_target_hash is None:
|
if known_target_hash is None:
|
||||||
return prompt_yes_no("Overwriting an unknown file, continue?", False)
|
return prompt_yes_no("Overwriting an unknown file, continue?", False)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue