Skip to main content

geam_core/host/
error.rs

1use ecow::EcoString;
2use thiserror::Error;
3
4#[derive(Debug, Error, PartialEq, Eq)]
5pub enum HostRegistrationError {
6    #[error("host module name {module} is invalid")]
7    InvalidModuleName { module: EcoString },
8
9    #[error("host function name {function} in module {module} is invalid")]
10    InvalidFunctionName {
11        module: EcoString,
12        function: EcoString,
13    },
14
15    #[error("host function {function} was registered more than once in module {module}")]
16    DuplicateFunction {
17        module: EcoString,
18        function: EcoString,
19    },
20
21    #[error("host external type name {type_} in module {module} is invalid")]
22    InvalidExternalTypeName { module: EcoString, type_: EcoString },
23
24    #[error("host external type {type_} was registered more than once in module {module}")]
25    DuplicateExternalType { module: EcoString, type_: EcoString },
26
27    #[error(
28        "host function {function} uses type parameter indices {parameters:?}; indices must be contiguous from zero"
29    )]
30    NonContiguousTypeParameters {
31        function: EcoString,
32        parameters: Box<[usize]>,
33    },
34
35    #[error(
36        "host function {function} registers construction type parameter indices {parameters:?} that do not occur in its signature"
37    )]
38    UnboundConstructionTypeParameters {
39        function: EcoString,
40        parameters: Box<[usize]>,
41    },
42
43    #[error(
44        "host module {module} was registered by both package {first_package} and package {second_package}"
45    )]
46    DuplicateModule {
47        module: EcoString,
48        first_package: EcoString,
49        second_package: EcoString,
50    },
51}