Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
Issue #1: add PackageNotFound exception
Browse files Browse the repository at this point in the history
  • Loading branch information
RickBarretto committed May 21, 2022
1 parent 9db113a commit fd97b09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/fetch_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from requests.exceptions import HTTPError

from src.core.utils.osv_model import OsvModel, OsvUrl
from src.core.utils.exceptions import PackageNotFound


def fetch_api(osv_model: OsvModel) -> dict:
Expand All @@ -17,3 +18,8 @@ def fetch_api(osv_model: OsvModel) -> dict:
json = response.json()

return json


def raise_for_not_found(json: dict):
if not json:
raise PackageNotFound
2 changes: 2 additions & 0 deletions src/core/utils/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class PackageNotFound(Exception):
pass

0 comments on commit fd97b09

Please sign in to comment.