Skip to content

Commit

Permalink
Change: Improve output on http errors for CVE and CPE CLI
Browse files Browse the repository at this point in the history
Print more information from the error response.
  • Loading branch information
bjoernricks authored and greenbonebot committed Dec 1, 2023
1 parent 8c16e51 commit 636dde4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pontos/nvd/cpe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from argparse import ArgumentParser, Namespace
from typing import Callable

import httpx

from pontos.nvd.cpe.api import CPEApi

__all__ = ("CPEApi",)
Expand Down Expand Up @@ -77,3 +79,5 @@ def main(parser: ArgumentParser, func: Callable) -> None:
asyncio.run(func(args))
except KeyboardInterrupt:
pass
except httpx.HTTPStatusError as e:
print(f"HTTP Error {e.response.status_code}: {e.response.text}")
4 changes: 4 additions & 0 deletions pontos/nvd/cve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from argparse import ArgumentParser, Namespace
from typing import Callable

import httpx

from pontos.nvd.cve.api import CVEApi

__all__ = ("CVEApi",)
Expand Down Expand Up @@ -88,3 +90,5 @@ def main(parser: ArgumentParser, func: Callable) -> None:
asyncio.run(func(args))
except KeyboardInterrupt:
pass
except httpx.HTTPStatusError as e:
print(f"HTTP Error {e.response.status_code}: {e.response.text}")

0 comments on commit 636dde4

Please sign in to comment.