relay-knowledge 1.1.16

Graph-database-based knowledge graph project.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Maps code-repository storage boundary failures into application API errors.

use crate::{api::ApiError, storage::StorageError};

pub(super) fn storage_api_error(error: StorageError) -> ApiError {
    match error {
        StorageError::CapacityExceeded(message) => ApiError::qos_rejected(message),
        StorageError::Invariant(message) => ApiError::internal(message),
        other => ApiError::storage_unavailable(other.to_string()),
    }
}

#[cfg(test)]
#[path = "mod_tests.rs"]
mod tests;