Skip to content

Commit

Permalink
πŸ”Š Do not show traceback for basic login errors (#838)
Browse files Browse the repository at this point in the history
* πŸ”Š Do not show traceback for basic login errors

* πŸ’š Fix test
  • Loading branch information
falexwolf authored Sep 3, 2024
1 parent fa8b4bf commit 888f328
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/hub-prod/test-insufficient-user-info.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"metadata": {},
"outputs": [],
"source": [
"with pytest.raises(RuntimeError):\n",
"with pytest.raises(SystemExit):\n",
" ln_setup.login(\"testuser1\", password=\"dummy\")"
]
},
Expand All @@ -120,7 +120,7 @@
"metadata": {},
"outputs": [],
"source": [
"with pytest.raises(RuntimeError):\n",
"with pytest.raises(SystemExit):\n",
" ln_setup.login(\"[email protected]\")"
]
},
Expand Down
10 changes: 5 additions & 5 deletions lamindb_setup/_setup_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def load_user(email: str | None = None, handle: str | None = None) -> str | None
else:
user_settings = load_or_create_user_settings()
if email is None:
raise RuntimeError(
"Use your email for your first login in a compute environment. "
raise SystemExit(
"βœ— Use your email for your first login in a compute environment. "
"After that, you can use your handle."
)
user_settings.email = email
Expand Down Expand Up @@ -76,11 +76,11 @@ def login(
user_settings.password = key

if user_settings.email is None:
raise RuntimeError("No stored user email, please call: lamin login {user}")
raise SystemExit("βœ— No stored user email, please call: lamin login {user}")

if user_settings.password is None:
raise RuntimeError(
"No stored API key, please call: lamin login <your-email> --key <API-key>"
raise SystemExit(
"βœ— No stored API key, please call: lamin login <your-email> --key <API-key>"
)

from .core._hub_core import sign_in_hub
Expand Down

0 comments on commit 888f328

Please sign in to comment.