surrealcs_kernel/utils/
log_error.rs

1//! Defines the utils around logging errors.
2
3/// As the system is actor based, sometimes we do not want to panic the thread because this can
4/// break the actor for other messages and transactions. For instance, the router actor is responsible
5/// for routing messages to all of the transaction actors associated with the connection. If we allow
6/// the router actor to panic for one transaction, then all of the other transactions will be lost
7/// for that connection. However, we cannot ignore the error because we must know what is going on.
8/// Therefore we have a macro that logs the error and continues.
9#[macro_export]
10macro_rules! log_error_and_continue {
11	($process:expr, $message:expr) => {
12		match $process {
13			Ok(_) => {}
14			Err(e) => {
15				tracing::error!("{}: {}", $message, e);
16			}
17		}
18	};
19}