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)]
|
||||
enum AuditEvent {
|
||||
Log(AuditLog),
|
||||
|
|
|
@ -391,13 +391,8 @@ impl BackendWriteTransaction {
|
|||
.conn
|
||||
.backup(rusqlite::DatabaseName::Main, dstPath, None);
|
||||
|
||||
match result {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => {
|
||||
audit_log!(audit, "Error in sqlite {:?}", e);
|
||||
Err(OperationError::SQLiteError)
|
||||
}
|
||||
}
|
||||
try_audit!(audit, result, "Error in sqlite {:?}", OperationError::SQLiteError);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Should this be offline only?
|
||||
|
|
Loading…
Reference in a new issue