Skip to main content

error_info

Function error_info 

Source
pub fn error_info(e: &Error) -> ErrorInfo
Expand description

Classify a query-engine error (ADR-0307, single-sourced by ADR-0502 §2). Exhaustive on purpose: a new engine variant does not compile until it has a code, a GQLSTATUS, a stage and a retryable verdict — the match that Bolt’s failures::error_class used to own alone.

use relate_error::{error_info, ErrorStage, PARAMETER_MISSING_CODE};

let e = relate_core::Error::parameters_missing(["p"]);
let info = error_info(&e);
assert_eq!(info.neo4j_code, PARAMETER_MISSING_CODE);
assert_eq!(info.gql_status, "42N02");
assert_eq!(info.stage, ErrorStage::Compile);
assert!(!info.retryable);