Skip to content

Commit 2a8d6a0

Browse files
committed
Raise errors rather than exit
1 parent 710b87e commit 2a8d6a0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

abcd/frontends/commandline/decorators.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ def wrapper(*args, config, **kwargs):
2424
use_ssl = config.get("use_ssl", None)
2525

2626
if url is None:
27-
print("Please use abcd login first!")
28-
exit(1)
27+
raise ConnectionError("Please use abcd login first!")
2928

3029
if use_ssl is None:
31-
print("use_ssl has not been saved. Please login again")
32-
exit(1)
30+
raise ConnectionError("use_ssl has not been saved. Please login again")
3331

3432
db = ABCD.from_url(url=url, use_ssl=use_ssl)
3533

@@ -52,8 +50,9 @@ def check_remote(func):
5250
@functools.wraps(func)
5351
def wrapper(*args, **kwargs):
5452
if kwargs.pop("remote"):
55-
print("In read only mode, you can't modify the data in the database")
56-
exit(1)
53+
raise PermissionError(
54+
"In read only mode, you can't modify the data in the database"
55+
)
5756

5857
func(*args, **kwargs)
5958

0 commit comments

Comments
 (0)