fluence_sdk_test_macro_impl/
errors.rs

1/*
2 * Copyright 2020 Fluence Labs Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17use fce_wit_parser::WITParserError;
18use fluence_app_service::AppServiceError;
19
20use darling::Error as DarlingError;
21use syn::Error as SynError;
22use thiserror::Error as ThisError;
23
24#[derive(Debug, ThisError)]
25pub enum TestGeneratorError {
26    #[error("Can't load Wasm modules into FCE: {0}")]
27    WITParserError(#[from] WITParserError),
28
29    #[error("{0}")]
30    CorruptedITSection(#[from] CorruptedITSection),
31
32    #[error("{0}")]
33    SynError(#[from] SynError),
34
35    #[error("Can't load Wasm modules from the provided config: {0}")]
36    ConfigLoadError(#[from] AppServiceError),
37
38    #[error("{0}")]
39    AttributesError(#[from] DarlingError),
40
41    #[error(
42        "neither modules_dir attribute specified nor service config contains modules_dir, please specify one of them"
43    )]
44    ModulesDirUnspecified,
45
46    #[error("a Wasm file compiled with newer version of sdk that supports multi-value")]
47    ManyFnOutputsUnsupported,
48}
49
50#[derive(Debug, ThisError)]
51pub enum CorruptedITSection {
52    #[error("record with {0} is absent in embedded IT section")]
53    AbsentRecord(u64),
54}