mirror of
https://github.com/frappe/bench.git
synced 2025-01-22 22:58:31 +00:00
Merge pull request #1598 from akhilnarang/exception-to-echo
refactor: change some exceptions to simple echo + exits
This commit is contained in:
commit
fcf7210f13
13
bench/app.py
13
bench/app.py
@ -23,7 +23,6 @@ import semantic_version as sv
|
|||||||
|
|
||||||
# imports - module imports
|
# imports - module imports
|
||||||
import bench
|
import bench
|
||||||
from bench.exceptions import NotInBenchDirectoryError
|
|
||||||
from bench.utils import (
|
from bench.utils import (
|
||||||
UNSET_ARG,
|
UNSET_ARG,
|
||||||
fetch_details_from_tag,
|
fetch_details_from_tag,
|
||||||
@ -706,10 +705,12 @@ def get_app(
|
|||||||
|
|
||||||
if not is_bench_directory(bench_path):
|
if not is_bench_directory(bench_path):
|
||||||
if not init_bench:
|
if not init_bench:
|
||||||
raise NotInBenchDirectoryError(
|
click.secho(
|
||||||
f"{os.path.realpath(bench_path)} is not a valid bench directory. "
|
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
|
from bench.utils.system import init
|
||||||
|
|
||||||
@ -851,9 +852,11 @@ def install_resolved_deps(
|
|||||||
|
|
||||||
def new_app(app, no_git=None, bench_path="."):
|
def new_app(app, no_git=None, bench_path="."):
|
||||||
if bench.FRAPPE_VERSION in (0, None):
|
if bench.FRAPPE_VERSION in (0, None):
|
||||||
raise NotInBenchDirectoryError(
|
click.secho(
|
||||||
f"{os.path.realpath(bench_path)} is not a valid bench directory."
|
f"{os.path.realpath(bench_path)} is not a valid bench directory.",
|
||||||
|
fg="red",
|
||||||
)
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# For backwards compatibility
|
# For backwards compatibility
|
||||||
app = app.lower().replace(" ", "_").replace("-", "_")
|
app = app.lower().replace(" ", "_").replace("-", "_")
|
||||||
|
@ -33,10 +33,5 @@ class CannotUpdateReleaseBench(ValidationError):
|
|||||||
class FeatureDoesNotExistError(CommandFailedError):
|
class FeatureDoesNotExistError(CommandFailedError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NotInBenchDirectoryError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class VersionNotFound(Exception):
|
class VersionNotFound(Exception):
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user