Exception Types#
labapi exports its public exception classes at the package top level so
callers can reliably catch failures by category.
Public Exception Hierarchy#
All custom exceptions inherit from
LabArchivesError:
Exception
`-- LabArchivesError
|-- AuthenticationError
|-- ApiError
|-- NodeExistsError
|-- PathError
`-- TraversalError
ExtractionError (which also inherits from ValueError) and its
subclass TreeChildParseError also exist but are not exported at the
package top level; import them from labapi.exceptions.
Import and catch these from labapi:
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 an intermediate path segment exists but is not a directory.