Exception Types#
The public exception classes can be imported from labapi.
Public Exception Hierarchy#
All custom exceptions inherit from
LabArchivesError:
Exception
`-- LabArchivesError
|-- AuthenticationError
|-- ApiError
| `-- TransportError
|-- NodeExistsError
|-- PathError
|-- TraversalError
|-- ExtractionError
| `-- TreeChildParseError
`-- PartialEntryCreateError
ExtractionError also inherits from ValueError.
For example:
from labapi import LabArchivesError, NodeExistsError, NotebookPage, TraversalError
try:
page = notebook.create(NotebookPage, "Experiments/2024/Results")
except NodeExistsError:
...
except ValueError:
...
except TraversalError:
...
except LabArchivesError:
...
Common Operations and Raised Exceptions#
create()Raises
NodeExistsErrorwhen creating a duplicate node withif_exists=InsertBehavior.Raise.Raises
ValueErrorfor any multi-segment path whenparents=False, even if the intermediate directories exist.traverse()Raises
TraversalErrorwhen a path segment is not found, or when an intermediate segment is not a directory.- Any call that sends a request to LabArchives
Raises
AuthenticationErrorwhen LabArchives rejects the credentials or session, andApiErrorfor any other non-2xx response. Both carry the LabArchives code inerror_code.Raises
TransportErrorwhen no HTTP response arrives: DNS, connect, TLS, proxy, or timeout failures, or a stream broken mid-read. It subclassesApiError, soexcept ApiErrorcatches both.