referrerpolicy=no-referrer-when-downgrade

sp_state_machine/
error.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// 	http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18/// State Machine Errors
19use core::fmt;
20
21/// State Machine Error bound.
22///
23/// This should reflect Wasm error type bound for future compatibility.
24pub trait Error: 'static + fmt::Debug + fmt::Display + Send + Sync {}
25
26impl<T: 'static + fmt::Debug + fmt::Display + Send + Sync> Error for T {}
27
28/// Externalities Error.
29///
30/// Externalities are not really allowed to have errors, since it's assumed that dependent code
31/// would not be executed unless externalities were available. This is included for completeness,
32/// and as a transition away from the pre-existing framework.
33#[derive(Debug, Eq, PartialEq)]
34#[allow(missing_docs)]
35#[cfg_attr(feature = "std", derive(thiserror::Error))]
36pub enum ExecutionError {
37	#[cfg_attr(feature = "std", error("Backend error {0:?}"))]
38	Backend(crate::DefaultError),
39
40	#[cfg_attr(feature = "std", error("`:code` entry does not exist in storage"))]
41	CodeEntryDoesNotExist,
42
43	#[cfg_attr(feature = "std", error("Unable to generate proof"))]
44	UnableToGenerateProof,
45
46	#[cfg_attr(feature = "std", error("Invalid execution proof"))]
47	InvalidProof,
48}