Skip to content

Commit

Permalink
fix(server): validate two_bit file before starting server
Browse files Browse the repository at this point in the history
  • Loading branch information
cauliyang committed Oct 25, 2023
1 parent 9b72742 commit 9e9615e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pxblat/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ def _start_nb(self):
if self._process is not None:
self._process.start()

def _check(self):
if not Path(self.two_bit).exists():
msg = f"Invalid two_bit file: {self.two_bit}"
raise FileNotFoundError(msg)

def start(self):
"""Starts the gfServer instance in either blocking or non-blocking mode.
Expand All @@ -346,10 +351,6 @@ def start(self):
Raises:
ValueError: If the given two_bit file or URL is invalid.
"""
if not Path(self.two_bit).exists():
msg = f"Invalid two_bit file: {self.two_bit}"
raise ValueError(msg)

self.option.build()
if not self._block:
self._start_nb()
Expand Down

0 comments on commit 9e9615e

Please sign in to comment.