errors
Error translation facilities to map lakeFS API errors to Python-native OS errors in the lakeFS file system.
This is important to honor the fsspec API contract, where users only need to expect builtin Python exceptions to avoid complicated error handling setups.
translate_lakefs_error ¶
translate_lakefs_error(
error: ServerException,
rpath: str | None = None,
message: str | None = None,
set_cause: bool = True,
) -> OSError
Convert a lakeFS server exception to a Python builtin exception.
For some subclasses of lakefs.exceptions.ServerException
, a direct Python builtin equivalent exists.
In these cases, the suitable equivalent is returned. All other classes are converted to a standard IOError
.
PARAMETER | DESCRIPTION |
---|---|
error |
The exception returned by the lakeFS SDK wrapper.
TYPE:
|
rpath |
The remote resource path involved in the error.
TYPE:
|
message |
An error message to use for the returned exception. If not given, the error message returned by the lakeFS server is used instead.
TYPE:
|
set_cause |
Whether to set the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
OSError
|
A builtin Python exception ready to be thrown. |