mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-24 04:57:00 +01:00
parent
3c964c51e7
commit
769bc5c17b
|
@ -52,6 +52,19 @@ macro_rules! audit_segment {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macro_rules! try_audit {
|
||||||
|
($audit:ident, $result:expr, $logFormat:expr, $errorType:expr) => {
|
||||||
|
match $result {
|
||||||
|
Ok(v) => v,
|
||||||
|
Err(e) => {
|
||||||
|
audit_log!($audit, $logFormat, e);
|
||||||
|
return Err($errorType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
enum AuditEvent {
|
enum AuditEvent {
|
||||||
Log(AuditLog),
|
Log(AuditLog),
|
||||||
|
|
|
@ -391,13 +391,8 @@ impl BackendWriteTransaction {
|
||||||
.conn
|
.conn
|
||||||
.backup(rusqlite::DatabaseName::Main, dstPath, None);
|
.backup(rusqlite::DatabaseName::Main, dstPath, None);
|
||||||
|
|
||||||
match result {
|
try_audit!(audit, result, "Error in sqlite {:?}", OperationError::SQLiteError);
|
||||||
Ok(_) => Ok(()),
|
Ok(())
|
||||||
Err(e) => {
|
|
||||||
audit_log!(audit, "Error in sqlite {:?}", e);
|
|
||||||
Err(OperationError::SQLiteError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should this be offline only?
|
// Should this be offline only?
|
||||||
|
|
Loading…
Reference in a new issue