Use io::Error::other

pull/779/head
Yuri Astrakhan 11 months ago
parent f5de5d3e98
commit 3dcae19e27
  1. 4
      .github/workflows/tests.yml
  2. 2
      Cargo.toml
  3. 2
      lib/oxigraph/src/sparql/error.rs
  4. 26
      lib/oxigraph/src/sparql/http/simple.rs
  5. 9
      lib/oxigraph/src/storage/backend/rocksdb.rs
  6. 2
      lib/oxigraph/src/storage/error.rs
  7. 17
      lib/oxigraph/src/storage/mod.rs
  8. 2
      lib/oxrdfxml/src/serializer.rs

@ -175,7 +175,7 @@ jobs:
submodules: true
- uses: ./.github/actions/setup-rust
with:
version: 1.70.0
version: 1.74.0
- run: rustup toolchain install nightly
- run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions
- run: cargo test
@ -312,7 +312,7 @@ jobs:
submodules: true
- uses: ./.github/actions/setup-rust
with:
version: 1.70.0
version: 1.74.0
- run: rustup toolchain install nightly
- uses: actions/setup-python@v4
with:

@ -23,7 +23,7 @@ version = "0.4.0-alpha.3-dev"
authors = ["Tpt <thomas@pellissier-tanon.fr>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.70"
rust-version = "1.74"
[workspace.dependencies]
anyhow = "1.0.72"

@ -138,7 +138,7 @@ impl From<EvaluationError> for io::Error {
EvaluationError::Storage(error) => error.into(),
EvaluationError::Service(error) => match error.downcast() {
Ok(error) => *error,
Err(error) => Self::new(io::ErrorKind::Other, error),
Err(error) => Self::other(error),
},
EvaluationError::GraphAlreadyExists(_)
| EvaluationError::GraphDoesNotExist(_)

@ -26,15 +26,10 @@ impl Client {
let response = self.client.request(request)?;
let status = response.status();
if !status.is_successful() {
return Err(Error::new(
ErrorKind::Other,
format!(
"Error {} returned by {} with payload:\n{}",
status,
url,
response.into_body().to_string()?
),
));
return Err(Error::other(format!(
"Error {status} returned by {url} with payload:\n{}",
response.into_body().to_string()?
)));
}
let content_type = response
.header(&HeaderName::CONTENT_TYPE)
@ -61,15 +56,10 @@ impl Client {
let response = self.client.request(request)?;
let status = response.status();
if !status.is_successful() {
return Err(Error::new(
ErrorKind::Other,
format!(
"Error {} returned by {} with payload:\n{}",
status,
url,
response.into_body().to_string()?
),
));
return Err(Error::other(format!(
"Error {status} returned by {url} with payload:\n{}",
response.into_body().to_string()?
)));
}
let content_type = response
.header(&HeaderName::CONTENT_TYPE)

@ -456,14 +456,11 @@ impl Db {
if let Some(available_fd) = available_file_descriptors()? {
if available_fd < 96 {
rocksdb_options_destroy(options);
return Err(io::Error::new(
io::ErrorKind::Other,
format!(
"Oxigraph needs at least 96 file descriptors, \
return Err(io::Error::other(format!(
"Oxigraph needs at least 96 file descriptors, \
only {available_fd} allowed. \
Run e.g. `ulimit -n 512` to allow 512 opened files"
),
)
))
.into());
}
rocksdb_options_set_max_open_files(

@ -50,7 +50,7 @@ impl From<StorageError> for io::Error {
match error {
StorageError::Io(error) => error,
StorageError::Corruption(error) => error.into(),
StorageError::Other(error) => Self::new(io::ErrorKind::Other, error),
StorageError::Other(error) => Self::other(error),
}
}
}

@ -1316,7 +1316,7 @@ impl StorageBulkLoader {
) -> Result<(), StorageError> {
let new_counter = *done
.lock()
.map_err(|_| io::Error::new(io::ErrorKind::Other, "Mutex poisoned"))?;
.map_err(|_| io::Error::other("Mutex poisoned"))?;
let display_step = DEFAULT_BULK_LOAD_BATCH_SIZE as u64;
if new_counter / display_step > *done_and_displayed / display_step {
for hook in &self.hooks {
@ -1355,7 +1355,7 @@ impl<'a> FileBulkLoader<'a> {
self.save()?;
*counter
.lock()
.map_err(|_| io::Error::new(io::ErrorKind::Other, "Mutex poisoned"))? +=
.map_err(|_| io::Error::other("Mutex poisoned"))? +=
size.try_into().unwrap_or(u64::MAX);
Ok(())
}
@ -1546,13 +1546,10 @@ impl<'a> FileBulkLoader<'a> {
#[cfg(not(target_family = "wasm"))]
fn map_thread_result<R>(result: thread::Result<R>) -> io::Result<R> {
result.map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
if let Ok(e) = e.downcast::<&dyn std::fmt::Display>() {
format!("A loader processed crashed with {e}")
} else {
"A loader processed crashed with and unknown error".into()
},
)
io::Error::other(if let Ok(e) = e.downcast::<&dyn std::fmt::Display>() {
format!("A loader processed crashed with {e}")
} else {
"A loader processed crashed with and unknown error".into()
})
})
}

@ -421,7 +421,7 @@ fn map_err(error: quick_xml::Error) -> io::Error {
if let quick_xml::Error::Io(error) = error {
Arc::try_unwrap(error).unwrap_or_else(|error| io::Error::new(error.kind(), error))
} else {
io::Error::new(io::ErrorKind::Other, error)
io::Error::other(error)
}
}

Loading…
Cancel
Save