Skip to content

Commit 4186627

Browse files
author
sangbida
committed
Add Simulation and Lightning error docs
1 parent 8785580 commit 4186627

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

simln-lib/src/lib.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,50 +186,72 @@ pub struct ActivityDefinition {
186186
pub amount_msat: Amount,
187187
}
188188

189+
/// Represents errors that can occur during simulation execution.
189190
#[derive(Debug, Error)]
190191
pub enum SimulationError {
192+
/// Error that occurred during Lightning Network operations
191193
#[error("Lightning Error: {0:?}")]
192194
LightningError(#[from] LightningError),
195+
/// Error that occurred during task execution
193196
#[error("TaskError")]
194197
TaskError,
198+
/// Error that occurred while writing CSV data
195199
#[error("CSV Error: {0:?}")]
196200
CsvError(#[from] csv::Error),
201+
/// Error that occurred during file operations
197202
#[error("File Error")]
198203
FileError,
204+
/// Error that occurred during random activity generation
199205
#[error("{0}")]
200206
RandomActivityError(RandomActivityError),
207+
/// Error that occurred in the simulated network
201208
#[error("Simulated Network Error: {0}")]
202209
SimulatedNetworkError(String),
210+
/// Error that occurred while accessing system time
203211
#[error("System Time Error: {0}")]
204212
SystemTimeError(#[from] SystemTimeError),
213+
/// Error that occurred when a required node was not found
205214
#[error("Missing Node Error: {0}")]
206215
MissingNodeError(String),
216+
/// Error that occurred in message passing channels
207217
#[error("Mpsc Channel Error: {0}")]
208218
MpscChannelError(String),
219+
/// Error that occurred while generating payment parameters
209220
#[error("Payment Generation Error: {0}")]
210221
PaymentGenerationError(PaymentGenerationError),
222+
/// Error that occurred while generating destination nodes
211223
#[error("Destination Generation Error: {0}")]
212224
DestinationGenerationError(DestinationGenerationError),
213225
}
214226

227+
/// Represents errors that can occur during Lightning Network operations.
215228
#[derive(Debug, Error)]
216229
pub enum LightningError {
230+
/// Error that occurred while connecting to a Lightning node
217231
#[error("Node connection error: {0}")]
218232
ConnectionError(String),
233+
/// Error that occurred while retrieving node information
219234
#[error("Get info error: {0}")]
220235
GetInfoError(String),
236+
/// Error that occurred while sending a payment
221237
#[error("Send payment error: {0}")]
222238
SendPaymentError(String),
239+
/// Error that occurred while tracking a payment
223240
#[error("Track payment error: {0}")]
224241
TrackPaymentError(String),
242+
/// Error that occurred when a payment hash is invalid
225243
#[error("Invalid payment hash")]
226244
InvalidPaymentHash,
245+
/// Error that occurred while retrieving information about a specific node
227246
#[error("Get node info error: {0}")]
228247
GetNodeInfoError(String),
248+
/// Error that occurred during configuration validation
229249
#[error("Config validation failed: {0}")]
230250
ValidationError(String),
251+
/// Error that represents a permanent failure condition
231252
#[error("Permanent error: {0:?}")]
232253
PermanentError(String),
254+
/// Error that occurred while listing channels
233255
#[error("List channels error: {0}")]
234256
ListChannelsError(String),
235257
}
@@ -286,6 +308,7 @@ pub trait LightningNode: Send {
286308
async fn list_channels(&mut self) -> Result<Vec<u64>, LightningError>;
287309
}
288310

311+
/// Represents an error that occurs when generating a destination for a payment.
289312
#[derive(Debug, Error)]
290313
#[error("Destination generation error: {0}")]
291314
pub struct DestinationGenerationError(String);

0 commit comments

Comments
 (0)