sharedlib/error/
mod.rs

1//! Defines errors which may be returned by [sharedlib](index.html).
2
3use std::path::PathBuf;
4
5error_chain! {
6    types { }
7
8    links { }
9
10    foreign_links { }
11
12    errors {
13        LibraryClose {
14            description("A shared library failed to close.")
15            display(
16                "{}",
17                "A shared library failed to close.",
18            )
19        }
20
21        LibraryFindSymbol(symbol: String) {
22            description("Failed to find a symbol in a shared library.")
23            display(
24                "{}{}{}",
25                "The search for symbol, '",
26                symbol,
27                "', from a shared library failed.",
28            )
29        }
30
31        LibraryOpen(path_to_lib: PathBuf) {
32            description("A shared library failed to open.")
33            display(
34                "{}{}{}",
35                "The shared library at path, '",
36                path_to_lib.to_string_lossy(),
37                "', failed to open.",
38            )
39        }
40
41        OsError(cause: String, function_called: String) {
42            description("A call to a native function failed.")
43            display(
44                "{}{}{}{}",
45                "A call to the native function, '",
46                function_called,
47                "', failed. Cause\n",
48                cause
49            )
50        }
51
52        OsErrorFailure(function_called: String) {
53            description("A call to a native function failed but the operating system reported success.")
54            display(
55                "{}{}{}",
56                "A call to the native function, '",
57                function_called,
58                "', failed but the operating system reported success.",
59            )
60        }
61    }
62}