Skip to content

Commit 3f9df9d

Browse files
committed
construct errors module
1 parent d030841 commit 3f9df9d

3 files changed

Lines changed: 23 additions & 41 deletions

File tree

fuzz/build_fuzz.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
python3 build_fuzz.py --mode both [project_list] --oss-fuzz-dir /path/to/oss-fuzz --sanitizer address
1919
2020
Example:
21-
python3 ./fuzz/build_fuzz.py --mode both data/valid_projects3.txt \
21+
python3 fuzz/build_fuzz.py --mode both data/valid_projects3.txt \
2222
--oss-fuzz-dir ./fuzz/oss-fuzz \
2323
--sanitizer address \
2424
--workers 8
@@ -33,28 +33,8 @@
3333
from pathlib import Path
3434
from returns.maybe import Maybe
3535
from multiprocessing import Pool
36+
from errors import BuildError, CommandError, PathError, ConfigError
3637

37-
# ========================================================================================
38-
# Custom Exceptions
39-
# ========================================================================================
40-
class BuildError(Exception):
41-
"""Base exception for build failures"""
42-
def __init__(self, message: str, project: str = "", exit_code: int | None = None):
43-
super().__init__(message)
44-
self.project = project
45-
self.exit_code = exit_code
46-
47-
class CommandError(BuildError):
48-
"""Exception for command execution failures"""
49-
pass
50-
51-
class PathError(BuildError):
52-
"""Exception for missing paths or files"""
53-
pass
54-
55-
class ConfigError(BuildError):
56-
"""Exception for configuration errors"""
57-
pass
5838

5939
# ========================================================================================
6040
# Helper Functions

fuzz/build_fuzzers.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,7 @@
2626
from pathlib import Path
2727
from typing import Optional
2828
from multiprocessing import Pool, cpu_count
29-
30-
class BuildError(Exception):
31-
"""Base exception for build failures"""
32-
def __init__(self, message: str, project: str = "", exit_code: Optional[int] = None):
33-
super().__init__(message)
34-
self.project = project
35-
self.exit_code = exit_code
36-
37-
class CommandError(BuildError):
38-
"""Exception for command execution failures"""
39-
pass
40-
41-
class PathError(BuildError):
42-
"""Exception for missing paths or files"""
43-
pass
44-
45-
class ConfigError(BuildError):
46-
"""Exception for configuration errors"""
47-
pass
29+
from errors import BuildError, CommandError, PathError, ConfigError
4830

4931
def run_command(
5032
cmd: str,

fuzz/errors.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# fuzz/errors.py
2+
3+
class BuildError(Exception):
4+
"""Base exception for build failures"""
5+
def __init__(self, message: str, project: str = "", exit_code: int | None = None):
6+
super().__init__(message)
7+
self.project = project
8+
self.exit_code = exit_code
9+
10+
class CommandError(BuildError):
11+
"""Exception for command execution failures"""
12+
pass
13+
14+
class PathError(BuildError):
15+
"""Exception for missing paths or files"""
16+
pass
17+
18+
class ConfigError(BuildError):
19+
"""Exception for configuration errors"""
20+
pass

0 commit comments

Comments
 (0)