Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize on obstore's NotFoundError #199

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyo3-object_store/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Contains the [`PyObjectStoreError`], the error enum returned by all fallible functions in this
//! crate.

use pyo3::exceptions::{PyFileNotFoundError, PyIOError, PyNotImplementedError, PyValueError};
use pyo3::exceptions::{PyIOError, PyNotImplementedError, PyValueError};
use pyo3::prelude::*;
use pyo3::{create_exception, DowncastError};
use thiserror::Error;
Expand Down Expand Up @@ -113,7 +113,7 @@ impl From<PyObjectStoreError> for PyErr {
source: _,
} => GenericError::new_err(format!("{err:#?}")),
object_store::Error::NotFound { path: _, source: _ } => {
PyFileNotFoundError::new_err(format!("{err:#?}"))
NotFoundError::new_err(format!("{err:#?}"))
}
object_store::Error::InvalidPath { source: _ } => {
InvalidPathError::new_err(format!("{err:#?}"))
Expand Down
5 changes: 3 additions & 2 deletions tests/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

import obstore as obs
from obstore.exceptions import NotFoundError
from obstore.store import LocalStore, MemoryStore


Expand Down Expand Up @@ -50,7 +51,7 @@ def test_delete_one_local_fs():
obs.delete(store, "file3.txt")
assert len(obs.list(store).collect()) == 0

with pytest.raises(FileNotFoundError):
with pytest.raises(NotFoundError):
obs.delete(store, "file1.txt")


Expand All @@ -68,7 +69,7 @@ def test_delete_many_local_fs():
["file1.txt", "file2.txt", "file3.txt"],
)

with pytest.raises(FileNotFoundError):
with pytest.raises(NotFoundError):
obs.delete(
store,
["file1.txt", "file2.txt", "file3.txt"],
Expand Down
Loading