Represents one failed apoCHARMM native operation in Python. More...
Inherits RuntimeError.
Public Member Functions | |
| None | __init__ (self, int status, str context, str native_diagnostic) |
| Constructs a Python exception from status and diagnostic fields. | |
| int | status (self) |
| Returns the exact numeric C ABI status. | |
| str | status_name (self) |
| Returns the symbolic name associated with the numeric status. | |
| str | context (self) |
| Returns the Python-facing operation context. | |
| str | native_diagnostic (self) |
| Returns the copied and decoded native diagnostic. | |
| str | message (self) |
| Returns the complete rendered Python exception message. | |
Represents one failed apoCHARMM native operation in Python.
The exception retains the exact numeric C ABI status, a known exported status name or APO_STATUS_UNKNOWN, the Python operation context, the decoded native diagnostic, and the final rendered message. It is also a RuntimeError, so callers may catch either class.
check_status() copies and decodes the native thread-local C string before constructing this object. The exception therefore owns Python references that remain valid after later native calls. The rendered message normalizes CRLF and lone carriage returns to line feeds, while native_diagnostic retains the original decoded text.
| None apocharmm.error.ApoCharmmError.__init__ | ( | self, | |
| int | status, | ||
| str | context, | ||
| str | native_diagnostic | ||
| ) |
Constructs a Python exception from status and diagnostic fields.
status is converted with int(). Unknown integer values are retained and use APO_STATUS_UNKNOWN. A single-line diagnostic is separated from the context header by ": ". A multiline diagnostic begins on the next line unless it already starts with a newline, which preserves the native apoCHARMM banner layout.
| [in] | status | C ABI status or another object accepted by int(). |
| [in] | context | Python-facing operation description retained in the rendered header. |
| [in] | native_diagnostic | Decoded native diagnostic retained without newline normalization. |
| TypeError | If status cannot be converted with int(). |
| ValueError | If int() rejects the supplied status value. |
| OverflowError | If int() reports an overflow while converting status. |
| str apocharmm.error.ApoCharmmError.context | ( | self | ) |
Returns the Python-facing operation context.
| str apocharmm.error.ApoCharmmError.message | ( | self | ) |
Returns the complete rendered Python exception message.
str(error). | str apocharmm.error.ApoCharmmError.native_diagnostic | ( | self | ) |
Returns the copied and decoded native diagnostic.
| int apocharmm.error.ApoCharmmError.status | ( | self | ) |
Returns the exact numeric C ABI status.
| str apocharmm.error.ApoCharmmError.status_name | ( | self | ) |
Returns the symbolic name associated with the numeric status.
APO_STATUS_* name, or "APO_STATUS_UNKNOWN" when the numeric value is not recognized.