mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-21 08:31:52 +03:00
improve checking arguments when converting the blockchain db (#10272)
* improve checking arguments when converting the blockchain db * don't print stack traces on errors in chia db upgrade
This commit is contained in:
parent
2f40ca5321
commit
9a0095b5aa
@ -21,14 +21,17 @@ def db_cmd() -> None:
|
||||
@click.pass_context
|
||||
def db_upgrade_cmd(ctx: click.Context, no_update_config: bool, **kwargs) -> None:
|
||||
|
||||
in_db_path = kwargs.get("input")
|
||||
out_db_path = kwargs.get("output")
|
||||
db_upgrade_func(
|
||||
Path(ctx.obj["root_path"]),
|
||||
None if in_db_path is None else Path(in_db_path),
|
||||
None if out_db_path is None else Path(out_db_path),
|
||||
no_update_config,
|
||||
)
|
||||
try:
|
||||
in_db_path = kwargs.get("input")
|
||||
out_db_path = kwargs.get("output")
|
||||
db_upgrade_func(
|
||||
Path(ctx.obj["root_path"]),
|
||||
None if in_db_path is None else Path(in_db_path),
|
||||
None if out_db_path is None else Path(out_db_path),
|
||||
no_update_config,
|
||||
)
|
||||
except RuntimeError as e:
|
||||
print(f"FAILED: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -65,6 +65,14 @@ def convert_v1_to_v2(in_path: Path, out_path: Path) -> None:
|
||||
|
||||
from contextlib import closing
|
||||
|
||||
if not in_path.exists():
|
||||
print(f"input file doesn't exist. {in_path}")
|
||||
raise RuntimeError(f"can't find {in_path}")
|
||||
|
||||
if in_path == out_path:
|
||||
print(f"output file is the same as the input {in_path}")
|
||||
raise RuntimeError("invalid conversion files")
|
||||
|
||||
if out_path.exists():
|
||||
print(f"output file already exists. {out_path}")
|
||||
raise RuntimeError("already exists")
|
||||
|
Loading…
Reference in New Issue
Block a user