surrealcs_kernel/utils/
log_error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Defines the utils around logging errors.

/// As the system is actor based, sometimes we do not want to panic the thread because this can
/// break the actor for other messages and transactions. For instance, the router actor is responsible
/// for routing messages to all of the transaction actors associated with the connection. If we allow
/// the router actor to panic for one transaction, then all of the other transactions will be lost
/// for that connection. However, we cannot ignore the error because we must know what is going on.
/// Therefore we have a macro that logs the error and continues.
#[macro_export]
macro_rules! log_error_and_continue {
	($process:expr, $message:expr) => {
		match $process {
			Ok(_) => {}
			Err(e) => {
				tracing::error!("{}: {}", $message, e);
			}
		}
	};
}