1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use fmt;
use ;
use Error;
/// A generic, type-erased error type for host-originating errors.
///
/// Errors are type-erased because the CLAP API does not support extracting error information from
/// a plugin or host, only that an error happened.
///
/// Errors originating from a user-provided host callback implementation are simply logged through
/// the host's provided logging facilities if available, or the standard error output ([`stderr`])
/// if not.
///
/// This error can be constructed either from any existing [`Error`] type, or from an arbitrary
/// error message.
///
/// # Example
///
/// ```
/// use std::io;
/// use clack_host::prelude::HostError;
///
/// fn foo () -> io::Result<()> {
/// /* ... */
/// # Ok(())
/// }
///
/// fn perform(valid: bool) -> Result<(), HostError> {
/// if !valid {
/// return Err(HostError::Message("Invalid value"))
/// }
/// /* ... */
/// foo()?;
/// /* ... */
/// Ok(())
/// }
/// # perform(true).unwrap()
/// ```
///
/// [`stderr`]: std::io::stderr