From 8a54a584f27fb52967ccda6fa76803fb9308c0da Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Tue, 31 Jan 2023 19:40:21 +1100 Subject: [PATCH] Handle results in action handle methods --- app/action.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/action.rb b/app/action.rb index 2c7ab02..bba2581 100644 --- a/app/action.rb +++ b/app/action.rb @@ -3,11 +3,17 @@ require "hanami/action" require "httparty" +require "dry-monads" +require "dry-matcher" +require "dry/matcher/result_matcher" module Adamantium class Action < Hanami::Action include Deps["logger", "settings", not_found_view: "views.not_found"] + include Dry::Matcher.for(:handle, with: Dry::Matcher::ResultMatcher) + include Dry::Monads[:result] + handle_exception ROM::TupleCountMismatchError => :not_found def authenticate!(req, res)