-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrouting_exceptions.py
More file actions
71 lines (45 loc) · 1.84 KB
/
routing_exceptions.py
File metadata and controls
71 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Routing Exceptions
Exception classes for routing operations, allowing the router to report
errors through exceptions instead of sys.exit() calls.
"""
class RoutingError(Exception):
"""Base exception for all routing errors."""
pass
class RoutingCancelled(RoutingError):
"""Raised when routing is cancelled by the user."""
pass
class ConfigurationError(RoutingError):
"""Raised when the routing configuration is invalid."""
pass
class NoPathFoundError(RoutingError):
"""Raised when no valid path can be found for a net."""
def __init__(self, net_id: int, net_name: str = "", message: str = ""):
self.net_id = net_id
self.net_name = net_name
super().__init__(message or f"No path found for net {net_name or net_id}")
class ObstacleMapError(RoutingError):
"""Raised when obstacle map construction fails."""
pass
class InputFileError(RoutingError):
"""Raised when input file cannot be read or parsed."""
pass
class OutputFileError(RoutingError):
"""Raised when output file cannot be written."""
pass
class LayerError(RoutingError):
"""Raised when layer configuration is invalid."""
pass
class GridResolutionError(RoutingError):
"""Raised when grid resolution causes issues."""
pass
class DependencyError(RoutingError):
"""Raised when required Python dependencies are missing."""
def __init__(self, missing_packages: list, message: str = ""):
self.missing_packages = missing_packages
super().__init__(message or f"Missing dependencies: {', '.join(missing_packages)}")
class NetNotFoundError(RoutingError):
"""Raised when specified net patterns match no nets."""
def __init__(self, patterns: list, message: str = ""):
self.patterns = patterns
super().__init__(message or f"No nets match patterns: {', '.join(patterns)}")