|
21 | 21 |
|
22 | 22 | from docker.types import Mount |
23 | 23 | from pydantic import BaseModel |
| 24 | +from requests import RequestException |
24 | 25 | from semver import Version |
25 | 26 |
|
26 | 27 | import config |
@@ -61,7 +62,7 @@ def __init__(self): |
61 | 62 | 'application/x-pie-executable', |
62 | 63 | 'application/x-sharedlib', |
63 | 64 | ], |
64 | | - version=Version(1, 0, 0), |
| 65 | + version=Version(1, 0, 1), |
65 | 66 | Schema=self.Schema, |
66 | 67 | ) |
67 | 68 | ) |
@@ -129,13 +130,16 @@ def _is_supported_arch(file_type_analysis: BaseModel) -> bool: |
129 | 130 | return any(supported_arch in arch_type for supported_arch in SUPPORTED_ARCHS) |
130 | 131 |
|
131 | 132 | def _do_full_analysis(self, file_path: str) -> dict: |
132 | | - output = self._run_cwe_checker_in_docker(file_path) |
| 133 | + try: |
| 134 | + output = self._run_cwe_checker_in_docker(file_path) |
| 135 | + except RequestException as e: |
| 136 | + raise AnalysisFailedError('No response from cwe_checker Docker container (possible timeout)') from e |
133 | 137 | if output is None: |
134 | | - raise AnalysisFailedError('Timeout or error during cwe_checker execution') |
| 138 | + raise AnalysisFailedError('cwe_checker output is missing (timeout or error during execution)') |
135 | 139 | try: |
136 | 140 | return self._parse_cwe_checker_output(output) |
137 | 141 | except json.JSONDecodeError as error: |
138 | | - raise AnalysisFailedError('cwe_checker execution failed') from error |
| 142 | + raise AnalysisFailedError('cwe_checker execution failed: Could not parse output') from error |
139 | 143 |
|
140 | 144 | def analyze(self, file_handle: FileIO, virtual_file_path: dict, analyses: dict[str, BaseModel]) -> Schema: |
141 | 145 | """ |
|
0 commit comments