error.rs 1.49 KB
Newer Older
1
// Copyright 2018-2021 Parity Technologies (UK) Ltd.
Hero Bird's avatar
Hero Bird committed
2
//
3
4
5
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Hero Bird's avatar
Hero Bird committed
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
Hero Bird's avatar
Hero Bird committed
8
//
9
10
11
12
13
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Hero Bird's avatar
Hero Bird committed
14

15
16
use derive_more::Display;

17
/// A dispatch result.
Hero Bird's avatar
Hero Bird committed
18
#[doc(hidden)]
19
20
21
pub type DispatchResult = core::result::Result<(), DispatchError>;

/// A dispatch error.
22
#[derive(Debug, Copy, Clone, Display)]
Hero Bird's avatar
Hero Bird committed
23
#[doc(hidden)]
24
pub enum DispatchError {
25
    #[display(fmt = "unknown selector")]
26
    UnknownSelector,
27
    #[display(fmt = "unknown constructor selector")]
28
    UnknownInstantiateSelector,
29
    #[display(fmt = "unknown message selector")]
30
31
    UnknownCallSelector,

32
    #[display(fmt = "unable to decoded input parameter bytes")]
33
    InvalidParameters,
34
    #[display(fmt = "unable to decoded input parameter bytes for constructor")]
35
    InvalidInstantiateParameters,
36
    #[display(fmt = "unable to decoded input parameter bytes for message")]
37
38
    InvalidCallParameters,

39
    #[display(fmt = "could not read input parameters")]
40
    CouldNotReadInput,
41
    #[display(fmt = "paid an unpayable message")]
42
    PaidUnpayableMessage,
43
}