git-gemini-forge 0.2.0

A simple Gemini server that serves a read-only view of public repositories from a Git forge.
/// The ways that retrieving config values might fail.
pub enum Error {
	/// The returned response did not match the expected shape.
	UnexpectedResponse,

	/// A problem occurred when communicating with the server.
	NetworkFailure,
}

fn fmt_error(err: &Error, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
	// Describe the various kinds of errors:
	match &err {
		Error::UnexpectedResponse => write!(f, "Can't understand the response from the git forge"),
		Error::NetworkFailure => write!(f, "Failed to communicate with the git forge"),
	}
}

impl std::fmt::Debug for Error {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		fmt_error(&self, f)
	}
}

impl core::fmt::Display for Error {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		fmt_error(&self, f)
	}
}

impl std::error::Error for Error {}