use uqa_core::DocId;
use uqa_sql::SQLError;
pub use uqa_sql::catalog::errors::dml_storage_error;
pub use crate::storage_errors::storage_error as identifier_storage_error;
pub fn missing_document_error(action: &str, table: &str, doc_id: DocId) -> SQLError {
SQLError::Internal(format!(
"{action}: document {doc_id} listed by table `{table}` disappeared during the statement"
))
}
pub fn triggered_modification_error(operation: &str) -> SQLError {
SQLError::Diagnostic {
sqlstate: "27000".into(),
message: format!(
"tuple to be {operation} was already modified by an operation triggered by the current command"
),
detail: None,
hint: Some(
"Consider using an AFTER trigger instead of a BEFORE trigger to propagate changes to other rows."
.into(),
),
}
}