geam_core/planner/error/
host.rs1use crate::host::{HostCustomTypeSchema, HostExternalTypeSchema};
2use crate::plan::{CustomTypeName, ExternalTypeName, FunctionType, TypeScheme};
3use thiserror::Error;
4
5#[derive(Debug, Error, Clone, PartialEq, Eq)]
6pub enum ExternalTypeProviderLinkReason {
7 #[error("source module is not linked")]
8 MissingModule,
9 #[error("external type registration is missing")]
10 MissingRegistration,
11 #[error("type declaration is missing")]
12 MissingDeclaration,
13 #[error("external storage type has source constructors")]
14 ConstructorBackedType,
15 #[error("external type identity mismatch: expected {expected:?}, got {actual:?}")]
16 IdentityMismatch {
17 expected: ExternalTypeName,
18 actual: ExternalTypeName,
19 },
20 #[error("external type expects {expected} type arguments, but host ABI declares {actual}")]
21 ParameterCount { expected: usize, actual: usize },
22}
23
24#[derive(Debug, Error, Clone, PartialEq, Eq)]
25pub enum HostProviderLinkReason {
26 #[error("source module is not linked")]
27 MissingModule,
28 #[error("function declaration is missing")]
29 MissingDeclaration,
30 #[error("function is not external")]
31 NonExternalFunction,
32 #[error(
33 "function scheme mismatch: expected {expected_scheme:?} {expected_type:?}, got {actual_scheme:?} {actual_type:?}"
34 )]
35 SchemeMismatch {
36 expected_scheme: TypeScheme,
37 expected_type: FunctionType,
38 actual_scheme: TypeScheme,
39 actual_type: FunctionType,
40 },
41 #[error("custom type {custom_type:?} is missing")]
42 MissingCustomType { custom_type: CustomTypeName },
43 #[error("custom type {custom_type:?} is not visible to the host function")]
44 CustomTypeVisibility { custom_type: CustomTypeName },
45 #[error(
46 "custom type {custom_type:?} expects {expected} type arguments, but host ABI applies {actual}"
47 )]
48 CustomTypeArgumentCount {
49 custom_type: CustomTypeName,
50 expected: usize,
51 actual: usize,
52 },
53 #[error("custom schema mismatch: expected {expected:?}, got {actual:?}")]
54 CustomSchemaMismatch {
55 expected: HostCustomTypeSchema,
56 actual: HostCustomTypeSchema,
57 },
58 #[error("external type {external_type:?} is missing")]
59 MissingExternalType { external_type: ExternalTypeName },
60 #[error(
61 "external type {external_type:?} expects {expected} type arguments, but host ABI applies {actual}"
62 )]
63 ExternalTypeArgumentCount {
64 external_type: ExternalTypeName,
65 expected: usize,
66 actual: usize,
67 },
68 #[error("external schema mismatch: expected {expected:?}, got {actual:?}")]
69 ExternalSchemaMismatch {
70 expected: HostExternalTypeSchema,
71 actual: HostExternalTypeSchema,
72 },
73}