From 3e1d6595cef776677a2ba34542a2a27aa7acbbce Mon Sep 17 00:00:00 2001 From: "Tj (bougyman) Vanderpoel" Date: Thu, 31 Jul 2025 12:09:09 -0500 Subject: [PATCH 1/2] fix: Corrects the version --- .release-please-manifest.json | 2 +- Readme.adoc | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 054e8bc..466df71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.7" + ".": "0.1.0" } diff --git a/Readme.adoc b/Readme.adoc index 799902a..eb360e4 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -11,12 +11,14 @@ minimal DSL for defining endpoints and middleware. == Features -* Declarative endpoint definitions with `endpoint`. -* Middleware support using `use`. -* Simple concurrency via `run` with a configurable number of instances. +* Declarative endpoint definitions with `#endpoint`. +* Grouping of endpoints with `#group` +* Simple concurrency via `#run` with a configurable number of instances. * JSON aware message wrapper that gracefully handles parse errors. +* Middleware support using `#use`. * Railway Oriented Design, using {dry-monads} for success and failure handling. * {dry-configurable} settings container. +* `#logger` defaults to SemanticLogger (adjustable as the `#logger=` setting) == Requirements From ff856ffea3337bc41af3444e0af0bc2ff5a7726b Mon Sep 17 00:00:00 2001 From: "Tj (bougyman) Vanderpoel" Date: Thu, 31 Jul 2025 12:18:43 -0500 Subject: [PATCH 2/2] fix: Adds ResultError and raises on non-monad results --- lib/leopard/errors.rb | 1 + lib/leopard/nats_api_server.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/leopard/errors.rb b/lib/leopard/errors.rb index f7054a2..a66b24c 100644 --- a/lib/leopard/errors.rb +++ b/lib/leopard/errors.rb @@ -4,5 +4,6 @@ module Rubyists module Leopard class Error < StandardError; end class ConfigurationError < Error; end + class ResultError < Error; end end end diff --git a/lib/leopard/nats_api_server.rb b/lib/leopard/nats_api_server.rb index b8bd560..f2d12cc 100644 --- a/lib/leopard/nats_api_server.rb +++ b/lib/leopard/nats_api_server.rb @@ -202,10 +202,12 @@ def handle_message(raw_msg, handler) # Processes the result of the handler execution. # + # # @param wrapper [MessageWrapper] The message wrapper containing the raw message. # @param result [Dry::Monads::Result] The result of the handler execution. # # @return [void] + # @raise [ResultError] If the result is not a Success or Failure monad. def process_result(wrapper, result) case result in Dry::Monads::Success @@ -213,6 +215,9 @@ def process_result(wrapper, result) in Dry::Monads::Failure logger.error 'Error processing message: ', result.failure wrapper.respond_with_error(result.failure) + else + logger.error('Unexpected result: ', result:) + raise ResultError, "Unexpected Response from Handler, must respond with a Success or Failure monad: #{result}" end end end