Errors#
All UNIT errors inherit from Error and also from the most
appropriate Python built-in exception, so standard except clauses
work naturally.
try:
proc.divide()
except ValueError as e:
# catches unit.InvalidUsage (which inherits ValueError)
print(e)
try:
proc.compile()
except unit.Error as e:
# catches any UNIT error
print(e)
- class unit.Error#
Base class for all UNIT errors. Inherits from the internal C extension error type.
- message: str#
The error message from the C library.
- class unit.NoMemory#
Raised when memory allocation fails. Inherits from both
ErrorandMemoryError.
- class unit.InvalidUsage#
Raised when the API is used incorrectly, such as dividing by zero during constant folding, or emitting instructions in an invalid order. Inherits from both
ErrorandValueError.
- class unit.OSFailure#
Raised when an operating system call fails, such as
mmapduring JIT compilation. Inherits from bothErrorandOSError.
- class unit.UnsupportedPlatform#
Raised when compiling for a platform that UNIT does not support. Inherits from
Error.