Skip to content

Commit

Permalink
updated errors
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Jan 11, 2024
1 parent 92780bc commit d3010f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pepdbagent/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0a4"
__version__ = "0.7.0a5"
12 changes: 6 additions & 6 deletions pepdbagent/modules/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
DEFAULT_TAG,
PKG_NAME,
)
from pepdbagent.exceptions import ViewNotFoundError, SampleAlreadyInView
from pepdbagent.exceptions import ViewNotFoundError, SampleAlreadyInView, ProjectNotFoundError, SampleNotFoundError

from pepdbagent.db_utils import BaseEngine, Samples, Projects, Views, ViewSampleAssociation
from pepdbagent.models import ViewAnnotation, CreateViewDictModel, ProjectViews
Expand Down Expand Up @@ -158,7 +158,7 @@ def create(
with Session(self._sa_engine) as sa_session:
project = sa_session.scalar(project_statement)
if not project:
raise ValueError(
raise ProjectNotFoundError(
f"Project {view_dict.project_namespace}/{view_dict.project_name}:{view_dict.project_tag} does not exist"
)
view = Views(
Expand All @@ -177,7 +177,7 @@ def create(
)
sample_id = sa_session.execute(sample_statement).one()[0]
if not sample_id:
raise ValueError(
raise SampleNotFoundError(
f"Sample {view_dict.project_namespace}/{view_dict.project_name}:{view_dict.project_tag}:{sample_name} does not exist"
)
sa_session.add(ViewSampleAssociation(sample_id=sample_id, view=view))
Expand Down Expand Up @@ -260,7 +260,7 @@ def add_sample(
)
sample = sa_session.scalar(sample_statement)
if not sample:
raise ValueError(
raise SampleNotFoundError(
f"Sample {namespace}/{name}:{tag}:{sample_name} does not exist"
)
try:
Expand Down Expand Up @@ -346,7 +346,7 @@ def get_snap_view(
with Session(self._sa_engine) as sa_session:
project = sa_session.scalar(project_statement)
if not project:
raise ValueError(f"Project {namespace}/{name}:{tag} does not exist")
raise ProjectNotFoundError(f"Project {namespace}/{name}:{tag} does not exist")
samples = []
for sample_name in sample_name_list:
sample_statement = select(Samples).where(
Expand All @@ -357,7 +357,7 @@ def get_snap_view(
)
sample = sa_session.scalar(sample_statement)
if not sample:
raise ValueError(
raise SampleNotFoundError(
f"Sample {namespace}/{name}:{tag}:{sample_name} does not exist"
)
samples.append(sample.sample)
Expand Down

0 comments on commit d3010f7

Please sign in to comment.