From 792de8e49fa8a3c04bfb747adadf71572d753055 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 18 Jul 2025 01:12:36 -0400 Subject: Remove `pilcrow::cli::Error` from the lib crate's public interface. This might be the pettiest rude change I've ever made to a Rust program. If I saw this - or did this - in code _intend_ to be used as a library, I'd be appalled. --- src/cli.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index 8dac8ff..703bf19 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -84,11 +84,10 @@ impl Args { /// # Errors /// /// Will return `Err` if the server is unable to start, or terminates - /// prematurely. The specific [`Error`] variant will expose the cause + /// prematurely. The returned error contains a user-facing explanation /// of the failure. - pub async fn run(self) -> Result<(), Error> { + pub async fn run(self) -> Result<(), impl std::error::Error> { self.umask.set(); - let pool = self.pool().await?; let app = App::from(pool); @@ -104,7 +103,7 @@ impl Args { println!("{started_msg}"); serve.await?; - Ok(()) + Result::<_, Error>::Ok(()) } async fn listener(&self) -> io::Result { @@ -138,14 +137,10 @@ fn started_msg(listener: &net::TcpListener) -> io::Result { Ok(format!("listening on http://{local_addr}/")) } -/// Errors that can be raised by [`Args::run`]. #[derive(Debug, thiserror::Error)] #[error(transparent)] -pub enum Error { - /// Failure due to an I/O-related error. +enum Error { Io(#[from] io::Error), - /// Failure due to a database initialization error. Database(#[from] db::Error), - /// Failure due to invalid umask-related options. Umask(#[from] umask::Error), } -- cgit v1.2.3