Skip to content

Improve error handling and representation

Currently Ğcli has multiple error variants:

/// custom error type intended to provide more convenient error message to user
#[derive(Debug)]
pub enum GcliError {
	/// error coming from subxt
	Subxt(subxt::Error),
	/// error coming from duniter
	Duniter(String),
	/// error coming from indexer
	Indexer(String),
	/// logic error (illegal operation or security)
	Logic(String),
	/// input error
	Input(String),
	/// error coming from anyhow (to be removed)
	Anyhow(anyhow::Error),
	/// error coming from io
	IoError(std::io::Error),
}

but anyhow is often used event when a more domain specific error message could be given.

Anyhow variant should be used at its strict minimum.

Edited by Hugo Trentesaux