mirror of
https://github.com/frappe/bench.git
synced 2025-01-08 00:04:38 +00:00
refactor: change some exceptions to simple echo + exits
The traceback doesn't help in any meaningful way, just makes it harder to decipher the error Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
af8ed34201
commit
326bcab224
13
bench/app.py
13
bench/app.py
@ -23,7 +23,6 @@ import semantic_version as sv
|
||||
|
||||
# imports - module imports
|
||||
import bench
|
||||
from bench.exceptions import NotInBenchDirectoryError
|
||||
from bench.utils import (
|
||||
UNSET_ARG,
|
||||
fetch_details_from_tag,
|
||||
@ -706,10 +705,12 @@ def get_app(
|
||||
|
||||
if not is_bench_directory(bench_path):
|
||||
if not init_bench:
|
||||
raise NotInBenchDirectoryError(
|
||||
click.secho(
|
||||
f"{os.path.realpath(bench_path)} is not a valid bench directory. "
|
||||
"Run with --init-bench if you'd like to create a Bench too."
|
||||
"Run with --init-bench if you'd like to create a Bench too.",
|
||||
fg="red",
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
from bench.utils.system import init
|
||||
|
||||
@ -851,9 +852,11 @@ def install_resolved_deps(
|
||||
|
||||
def new_app(app, no_git=None, bench_path="."):
|
||||
if bench.FRAPPE_VERSION in (0, None):
|
||||
raise NotInBenchDirectoryError(
|
||||
f"{os.path.realpath(bench_path)} is not a valid bench directory."
|
||||
click.secho(
|
||||
f"{os.path.realpath(bench_path)} is not a valid bench directory.",
|
||||
fg="red",
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# For backwards compatibility
|
||||
app = app.lower().replace(" ", "_").replace("-", "_")
|
||||
|
@ -33,10 +33,5 @@ class CannotUpdateReleaseBench(ValidationError):
|
||||
class FeatureDoesNotExistError(CommandFailedError):
|
||||
pass
|
||||
|
||||
|
||||
class NotInBenchDirectoryError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class VersionNotFound(Exception):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user