1use crate::primitives::error::PrimitivesError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum ScriptError {
9 #[error("invalid script: {0}")]
10 InvalidScript(String),
11
12 #[error("invalid opcode: {0:#04x}")]
13 InvalidOpcode(u8),
14
15 #[error("stack underflow")]
16 StackUnderflow,
17
18 #[error("invalid stack operation: {0}")]
19 InvalidStackOperation(String),
20
21 #[error("memory limit exceeded")]
22 MemoryLimitExceeded,
23
24 #[error("script too long")]
25 ScriptTooLong,
26
27 #[error("invalid signature: {0}")]
28 InvalidSignature(String),
29
30 #[error("invalid public key: {0}")]
31 InvalidPublicKey(String),
32
33 #[error("number too large")]
34 NumberTooLarge,
35
36 #[error("division by zero")]
37 DivisionByZero,
38
39 #[error("verify failed")]
40 VerifyFailed,
41
42 #[error("disabled opcode: {0}")]
43 DisabledOpcode(String),
44
45 #[error("OP_EQUALVERIFY failed")]
46 EqualVerifyFailed,
47
48 #[error("OP_NUMEQUALVERIFY failed")]
49 NumEqualVerifyFailed,
50
51 #[error("OP_CHECKSIGVERIFY failed")]
52 CheckSigVerifyFailed,
53
54 #[error("OP_CHECKMULTISIGVERIFY failed")]
55 CheckMultiSigVerifyFailed,
56
57 #[error("null dummy violation")]
58 NullDummyViolation,
59
60 #[error("clean stack violation")]
61 CleanStackViolation,
62
63 #[error("push only violation")]
64 PushOnlyViolation,
65
66 #[error("invalid address: {0}")]
67 InvalidAddress(String),
68
69 #[error("invalid format: {0}")]
70 InvalidFormat(String),
71
72 #[error("minimal encoding violation")]
73 MinimalEncodingViolation,
74
75 #[error("invalid length: {0}")]
76 InvalidLength(String),
77
78 #[error("primitives error: {0}")]
79 Primitives(#[from] PrimitivesError),
80}