ethcontract_common/
errors.rs1use serde_json::Error as JsonError;
4use std::io::Error as IoError;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
9pub enum ArtifactError {
10 #[error("failed to open contract artifact file: {0}")]
12 Io(#[from] IoError),
13
14 #[error("failed to parse contract artifact JSON: {0}")]
16 Json(#[from] JsonError),
17
18 #[error("contract {0} has different ABIs on different chains")]
20 AbiMismatch(String),
21
22 #[error("chain with id {0} appears several times in the artifact")]
24 DuplicateChain(String),
25}
26
27#[derive(Debug, Error)]
29pub enum BytecodeError {
30 #[error("invalid bytecode length")]
32 InvalidLength,
33
34 #[error("placeholder at end of bytecode is too short")]
36 PlaceholderTooShort,
37
38 #[error("invalid hex digit '{0}'")]
40 InvalidHexDigit(char),
41}
42
43#[derive(Debug, Error)]
45pub enum LinkError {
46 #[error("unable to link library: can't find link placeholder for {0}")]
49 NotFound(String),
50
51 #[error("undefined library {0}")]
55 UndefinedLibrary(String),
56}
57
58#[derive(Clone, Debug, Error)]
60#[error("'{0}' is not a valid Solidity type")]
61pub struct ParseParamTypeError(pub String);