Skip to main content

aria_primitives/
lib.rs

1//! Foundational capabilities shared by Aria subsystems.
2
3pub mod cancel;
4#[cfg(not(target_family = "wasm"))]
5pub mod file_inspection;
6pub mod lazy;
7#[cfg(not(target_family = "wasm"))]
8pub mod local_socket;
9#[cfg(not(target_family = "wasm"))]
10pub mod private_document;
11#[cfg(not(target_family = "wasm"))]
12pub mod private_fs;
13// iOS forbids spawning a child process, so nothing built on one exists there.
14#[cfg(not(any(target_os = "ios", target_family = "wasm")))]
15pub mod process;
16pub mod slot;
17pub mod user_home;
18#[cfg(not(target_family = "wasm"))]
19pub mod wakeup;
20
21/// An error and every cause under it, joined into one line.
22///
23/// Errors here keep their detail in sources. A fault that becomes a plain
24/// string needs the whole chain, or it delivers only the outermost wrapper.
25/// Logs take `?error`, which already renders the chain.
26pub fn error_chain(error: &dyn std::error::Error) -> String {
27    let mut message = error.to_string();
28    let mut cause = error.source();
29    while let Some(error) = cause {
30        message.push_str(": ");
31        message.push_str(&error.to_string());
32        cause = error.source();
33    }
34    message
35}