Skip to content

Commit

Permalink
Refine exception handling #1328
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Jul 23, 2024
1 parent 22f4544 commit 7794e3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 3 additions & 5 deletions scanpipe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,11 +1259,9 @@ def add_message(
if resource:
details["resource_path"] = resource.path
if package:
# Do not change this field name as it has special behavior in templates.
details.update({
"package_url": package.package_url,
"package_uuid": package.uuid
})
details.update(
{"package_url": package.package_url, "package_uuid": package.uuid}
)

return ProjectMessage.objects.create(
project=self,
Expand Down
4 changes: 3 additions & 1 deletion scanpipe/pipes/purldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ def request_get(url, payload=None, timeout=DEFAULT_TIMEOUT, raise_on_error=False
response = session.get(url, params=params, timeout=timeout)
response.raise_for_status()
return response.json()
except (requests.RequestException, ValueError, TypeError) as exception:
except requests.RequestException: # raise_for_status
return
except (ValueError, TypeError) as exception:
logger.debug(f"[{label}] Request to {url} failed with exception: {exception}")
if raise_on_error:
raise PurlDBException(exception)
Expand Down

0 comments on commit 7794e3b

Please sign in to comment.