# The Python API raises two kinds of errors:
# - Python errors, such as ValueError and KeyError
# - tiledb.libtiledb.TileDBError from libtiledb
import tiledb
from tiledb.libtiledb import TileDBError
try:
# Open an array that does not exist
= tiledb.open("foo")
A
except TileDBError as err:
print("TileDB exception: ", err)
Catching Errors
You can handle errors within TileDB by using your preferred API language’s exception handling functionality.
How to run this tutorial
You can run this tutorial in two ways:
- Locally on your machine.
- On TileDB Cloud.
However, since TileDB Cloud has a free tier, we strongly recommend that you sign up and run everything there, as that requires no installations or deployment.
This tutorial explains how to capture errors from the TileDB array engine.
The following code snippet shows how you can capture an error resulting from opening an array that doesn’t exist. This method applies to any TileDB array functionality.