@@ -28,6 +28,7 @@ use stacks::monitoring::update_active_miners_count_gauge;
28
28
use stacks:: net:: atlas:: AtlasConfig ;
29
29
use stacks:: net:: relay:: Relayer ;
30
30
use stacks:: net:: stackerdb:: StackerDBs ;
31
+ use stacks:: util_lib:: db:: Error as DBError ;
31
32
use stacks_common:: types:: chainstate:: SortitionId ;
32
33
use stacks_common:: types:: StacksEpochId ;
33
34
@@ -71,46 +72,70 @@ pub struct StacksNode {
71
72
}
72
73
73
74
/// Types of errors that can arise during Nakamoto StacksNode operation
74
- #[ derive( Debug ) ]
75
+ #[ derive( thiserror :: Error , Debug ) ]
75
76
pub enum Error {
76
77
/// Can't find the block sortition snapshot for the chain tip
78
+ #[ error( "Can't find the block sortition snapshot for the chain tip" ) ]
77
79
SnapshotNotFoundForChainTip ,
78
80
/// The burnchain tip changed while this operation was in progress
81
+ #[ error( "The burnchain tip changed while this operation was in progress" ) ]
79
82
BurnchainTipChanged ,
80
83
/// The Stacks tip changed while this operation was in progress
84
+ #[ error( "The Stacks tip changed while this operation was in progress" ) ]
81
85
StacksTipChanged ,
82
86
/// Signers rejected a block
87
+ #[ error( "Signers rejected a block" ) ]
83
88
SignersRejected ,
84
89
/// Error while spawning a subordinate thread
90
+ #[ error( "Error while spawning a subordinate thread: {0}" ) ]
85
91
SpawnError ( std:: io:: Error ) ,
86
92
/// Injected testing errors
93
+ #[ error( "Injected testing errors" ) ]
87
94
FaultInjection ,
88
95
/// This miner was elected, but another sortition occurred before mining started
96
+ #[ error( "This miner was elected, but another sortition occurred before mining started" ) ]
89
97
MissedMiningOpportunity ,
90
98
/// Attempted to mine while there was no active VRF key
99
+ #[ error( "Attempted to mine while there was no active VRF key" ) ]
91
100
NoVRFKeyActive ,
92
101
/// The parent block or tenure could not be found
102
+ #[ error( "The parent block or tenure could not be found" ) ]
93
103
ParentNotFound ,
94
104
/// Something unexpected happened (e.g., hash mismatches)
105
+ #[ error( "Something unexpected happened (e.g., hash mismatches)" ) ]
95
106
UnexpectedChainState ,
96
107
/// A burnchain operation failed when submitting it to the burnchain
108
+ #[ error( "A burnchain operation failed when submitting it to the burnchain: {0}" ) ]
97
109
BurnchainSubmissionFailed ( BurnchainsError ) ,
98
110
/// A new parent has been discovered since mining started
111
+ #[ error( "A new parent has been discovered since mining started" ) ]
99
112
NewParentDiscovered ,
100
113
/// A failure occurred while constructing a VRF Proof
114
+ #[ error( "A failure occurred while constructing a VRF Proof" ) ]
101
115
BadVrfConstruction ,
116
+ #[ error( "The miner didn't accept their own block" ) ]
102
117
CannotSelfSign ,
118
+ #[ error( "A failure occurred while mining: {0}" ) ]
103
119
MiningFailure ( ChainstateError ) ,
104
120
/// The miner didn't accept their own block
121
+ #[ error( "The miner didn't accept their own block: {0}" ) ]
105
122
AcceptFailure ( ChainstateError ) ,
123
+ #[ error( "A failure occurred while signing a miner's block: {0}" ) ]
106
124
MinerSignatureError ( & ' static str ) ,
125
+ #[ error( "A failure occurred while signing a signer's block: {0}" ) ]
107
126
SignerSignatureError ( String ) ,
108
127
/// A failure occurred while configuring the miner thread
128
+ #[ error( "A failure occurred while configuring the miner thread: {0}" ) ]
109
129
MinerConfigurationFailed ( & ' static str ) ,
110
130
/// An error occurred while operating as the signing coordinator
131
+ #[ error( "An error occurred while operating as the signing coordinator: {0}" ) ]
111
132
SigningCoordinatorFailure ( String ) ,
112
133
// The thread that we tried to send to has closed
134
+ #[ error( "The thread that we tried to send to has closed" ) ]
113
135
ChannelClosed ,
136
+ /// DBError wrapper
137
+ #[ error( "DBError: {0}" ) ]
138
+ DBError ( #[ from] DBError ) ,
114
139
}
115
140
116
141
impl StacksNode {
0 commit comments