Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/knut

crates/graphar-falkordb/src/error.rs

use thiserror::Error;

pub type Result<T> = std::result::Result<T, FalkorError>;

#[derive(Debug, Error)]
pub enum FalkorError {
    #[error("Redis error: {0}")]
    Redis(#[from] redis::RedisError),

    #[error("Arrow error: {0}")]
    Arrow(#[from] arrow::error::ArrowError),

    #[error("Empty batch list — nothing to insert")]
    EmptyBatches,

    #[error("Column '{0}' not found in RecordBatch")]
    ColumnNotFound(String),

    #[error("Unsupported Arrow data type for Cypher conversion: {0}")]
    UnsupportedType(String),

    #[error("Batch size must be >= 1")]
    InvalidBatchSize,

    /// A `GRAPH.QUERY` reply carried no recognisable statistics block, so the
    /// number of entities the server actually created is **unknown**. Raised
    /// rather than falling back to "rows sent", because that fallback is what
    /// let a zero-edge load report success (`121200 nodes, 0 edges`).
    #[error(
        "GRAPH.QUERY reply carried no statistics block — cannot tell how many '{0}' the server created"
    )]
    UnreadableStats(&'static str),

    /// Every row was sent and the server created **nothing**. For an
    /// `UNWIND … MATCH … CREATE` edge load this is the silent-failure mode:
    /// the endpoints did not match, so the query succeeds and creates no
    /// relationship. `CREATE`-only vertex loads cannot legitimately hit it
    /// either. Never a warning — the load did not happen.
    #[error("{rows} rows sent but the server created 0 '{what}' — the load did not happen")]
    NothingCreated { what: &'static str, rows: usize },
}