From 6b0296e195942c0c6e48f013e8af28170507d486 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 18 May 2026 00:07:23 +0900 Subject: fix(compile): impl std::error::Error for custom error types --- crates/shirabe/src/downloader/transport_exception.rs | 8 ++++++++ crates/shirabe/src/event_dispatcher/script_execution_exception.rs | 8 ++++++++ crates/shirabe/src/exception/no_ssl_exception.rs | 8 ++++++++ crates/shirabe/src/json/json_validation_exception.rs | 8 ++++++++ crates/shirabe/src/package/loader/invalid_package_exception.rs | 8 ++++++++ crates/shirabe/src/plugin/plugin_blocked_exception.rs | 8 ++++++++ crates/shirabe/src/repository/invalid_repository_exception.rs | 8 ++++++++ crates/shirabe/src/repository/repository_security_exception.rs | 8 ++++++++ 8 files changed, 64 insertions(+) (limited to 'crates/shirabe') diff --git a/crates/shirabe/src/downloader/transport_exception.rs b/crates/shirabe/src/downloader/transport_exception.rs index a7c64e1..e4f04f3 100644 --- a/crates/shirabe/src/downloader/transport_exception.rs +++ b/crates/shirabe/src/downloader/transport_exception.rs @@ -56,3 +56,11 @@ impl TransportException { self.response_info = response_info; } } + +impl std::fmt::Display for TransportException { + fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + +impl std::error::Error for TransportException {} diff --git a/crates/shirabe/src/event_dispatcher/script_execution_exception.rs b/crates/shirabe/src/event_dispatcher/script_execution_exception.rs index fe871bc..23b763f 100644 --- a/crates/shirabe/src/event_dispatcher/script_execution_exception.rs +++ b/crates/shirabe/src/event_dispatcher/script_execution_exception.rs @@ -5,3 +5,11 @@ use shirabe_php_shim::RuntimeException; /// Thrown when a script running an external process exits with a non-0 status code #[derive(Debug)] pub struct ScriptExecutionException(pub RuntimeException); + +impl std::fmt::Display for ScriptExecutionException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl std::error::Error for ScriptExecutionException {} diff --git a/crates/shirabe/src/exception/no_ssl_exception.rs b/crates/shirabe/src/exception/no_ssl_exception.rs index dd025c7..968ecfd 100644 --- a/crates/shirabe/src/exception/no_ssl_exception.rs +++ b/crates/shirabe/src/exception/no_ssl_exception.rs @@ -5,3 +5,11 @@ use shirabe_php_shim::RuntimeException; /// Specific exception for Composer\Util\HttpDownloader creation. #[derive(Debug)] pub struct NoSslException(pub RuntimeException); + +impl std::fmt::Display for NoSslException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl std::error::Error for NoSslException {} diff --git a/crates/shirabe/src/json/json_validation_exception.rs b/crates/shirabe/src/json/json_validation_exception.rs index 465bc8b..5f3cbbf 100644 --- a/crates/shirabe/src/json/json_validation_exception.rs +++ b/crates/shirabe/src/json/json_validation_exception.rs @@ -20,3 +20,11 @@ impl JsonValidationException { &self.errors } } + +impl std::fmt::Display for JsonValidationException { + fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + +impl std::error::Error for JsonValidationException {} diff --git a/crates/shirabe/src/package/loader/invalid_package_exception.rs b/crates/shirabe/src/package/loader/invalid_package_exception.rs index b0eeb23..96725ba 100644 --- a/crates/shirabe/src/package/loader/invalid_package_exception.rs +++ b/crates/shirabe/src/package/loader/invalid_package_exception.rs @@ -41,3 +41,11 @@ impl InvalidPackageException { &self.warnings } } + +impl std::fmt::Display for InvalidPackageException { + fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + todo!() + } +} + +impl std::error::Error for InvalidPackageException {} diff --git a/crates/shirabe/src/plugin/plugin_blocked_exception.rs b/crates/shirabe/src/plugin/plugin_blocked_exception.rs index b8f2301..b554b13 100644 --- a/crates/shirabe/src/plugin/plugin_blocked_exception.rs +++ b/crates/shirabe/src/plugin/plugin_blocked_exception.rs @@ -4,3 +4,11 @@ use shirabe_php_shim::UnexpectedValueException; // TODO(plugin): PluginBlockedException is a part of Plugin API. pub struct PluginBlockedException(pub UnexpectedValueException); + +impl std::fmt::Display for PluginBlockedException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl std::error::Error for PluginBlockedException {} diff --git a/crates/shirabe/src/repository/invalid_repository_exception.rs b/crates/shirabe/src/repository/invalid_repository_exception.rs index 5798519..d66ed1a 100644 --- a/crates/shirabe/src/repository/invalid_repository_exception.rs +++ b/crates/shirabe/src/repository/invalid_repository_exception.rs @@ -5,3 +5,11 @@ use shirabe_php_shim::Exception; /// Exception thrown when a package repository is utterly broken #[derive(Debug)] pub struct InvalidRepositoryException(pub Exception); + +impl std::fmt::Display for InvalidRepositoryException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl std::error::Error for InvalidRepositoryException {} diff --git a/crates/shirabe/src/repository/repository_security_exception.rs b/crates/shirabe/src/repository/repository_security_exception.rs index c59b793..b517cad 100644 --- a/crates/shirabe/src/repository/repository_security_exception.rs +++ b/crates/shirabe/src/repository/repository_security_exception.rs @@ -5,3 +5,11 @@ use shirabe_php_shim::Exception; /// Thrown when a security problem, like a broken or missing signature #[derive(Debug)] pub struct RepositorySecurityException(pub Exception); + +impl std::fmt::Display for RepositorySecurityException { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl std::error::Error for RepositorySecurityException {} -- cgit v1.3.1